regex - Match if there is a X in the first and X the second Y can be 0 -


I am currently working on a program. I need a regex that takes Y and X and pairs of x are separated by y. It is not equal number, but it can not contain multiple Xs in favor of each other

Example:

  # matches do not: XXXYYYYY # match: XYXYYYY X  

Try my still:

  {y * [x | ^ X] y * [x | ^ X] y *} *  

The problem is that if there is an X in the first and X is in the other then Y can still be 0. Can I directly test for Double X?

What's the unusual about it?

  ^ (?: X (?! X) | y) + $  

explanation: it's just X and Y There is a series of x where X can not be followed by the second X (negative eye head).


Comments