One of my homework questions asked about developing a regular expression for all lines above x,y,zthat did not containxxx
After some reading, I found out about the negative look and did this, which works fine:
(x(?!xx)|y|z)*
And yet, in the spirit of completeness, is there anyway to write this without a negative look?
The reading I did makes me think that it can be done with some combination carets (^), but I cannot get the right combination, so I'm not sure.
Having made one more step, is it possible to exclude the type string xxxusing only the operator or (|), but still check the strings in a recursive way?
EDIT 9/6/2010:
I think I answered my question. I confused this with this, I will try to make this regular expression only with operators or (|), and I am sure that I understood it ... and it is not as useless as I thought. If someone else has time to verify this with the human eye, I would appreciate it.
(xxy|xxz|xy|xz|y|z)*(xxy|xxz|xx|xy|xz|x|y|z)
source
share