
May 6th, 2003, 06:40 PM
|
|
Junior Member
|
|
Join Date: May 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Regexp Difficulties
Hi. I want to match a string with a regexp patter similar to:
'/X(not foo|bar)X/'
Basically, it would match anything except 'XfooX' and 'XbarX'.
The closest pattern I can come up with is '/X[^(foo|bar)]X/'.
This, however, doesn't work because ()'s lose their "special powers" within []'s. Is there any simple way to do this? And if there's no simple way, what would be the complex way?
EDIT: Wait a minute... I guess I actually posted incorrectly. Sorry about that... I would want it to match strings such as 'XasdfX' and 'XffffffffffffffffX' and 'XzxbcvasdfaX'. I just don't want it to match the string if it has 'foo' or 'bar' in the middle of the X's. In fact, I would also like it to match 'foo XasdfX bar'.
Last edited by douceur : May 6th, 2003 at 06:54 PM.
|