Help for this page
XY|YX
XYZ|XZY|YXZ|YZX|ZXY|ZYX
(?:X|Y){2} (?# for the first example) (?:X|Y|Z){3} (?# for the second)
(?:(?(1)NOTMATCH|(X))|(?(2)NOTMATCH|(Y))|(?(3)NOTMATCH|(Z))){3}