This should do it:
X[^\w]*>|>[^\w]*X(?![^\w]*>)
A negative look-ahead after the low-prioritized alternative. When it finds "> X", but there is a " >" after it, it should be skipped in favor of "X >".
MizardX
2009-03-22 09:16:46