B
Ben Holness
Hi all,
I would like to know if it is possible to have nots in a single regular
expression and if so, how to do it?
For example if I want a single regular expression that says:
The phrase must have the string "Perl" and must not be followed by "PHP" in it, so that it
would match:
"I like Perl"
"Perl is cool"
But not match
"I like Perl more than PHP"
"Although PHP is OK"
I haven't been able to work out how to do it, but if '!' were the not
operator, then I guess it would be something like
/Perl.*!
I would like to know if it is possible to have nots in a single regular
expression and if so, how to do it?
For example if I want a single regular expression that says:
The phrase must have the string "Perl" and must not be followed by "PHP" in it, so that it
would match:
"I like Perl"
"Perl is cool"
But not match
"I like Perl more than PHP"
"Although PHP is OK"
I haven't been able to work out how to do it, but if '!' were the not
operator, then I guess it would be something like
/Perl.*!
PHP:
/
Searching hasn't been much help - the word "not" is way too common :)
Cheers,
Ben