+7  A: 

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