Edit------ Found the answer, will post for future reference soon.
I was wondering if I could get help with a simple regex task.
I have three letters: X
, Y
and Z
(those exact letters).
I need to write a regex for a word composed only of those three that does not have the same letters twice immediately after each other.
So for example:
Xyxzyx
qualifies, but Xxyzx
does not, because of the Xx
.
Edit: oh god i forgot to mention this. I have tried looking at the thing multiple times, have come up with something like this so far:
when there are only two letters, the only possible arrange ment is like this: y? (xy)* x?. Then, the third letter may break the pattern sometimes (or never), and i am trying to look into what happens after and how it can loop back to the repeating two characters, i think it will look something like this:
y? ( (xy)* x? z (-some stuff-) )* -possibly more stuff-
Also i am not permitted to use programming language-specific stuff, like reversal, only pure regex.