From: "Rob Coops" <[EMAIL PROTECTED]>
> You could simply say this:
> if ( ! m/ab/ ) {
> #make the world go round
> }
> Or assuming you are looping thru a list you could say something like:
> foreach my $item ( @list ) {
> next if ( $item =~ m/ab/ );
> #make the world go round
> }

I also had this problem some time ago but I couldn't find a solution for it.
I wanted to test something like:

Match only if the string contains somewhere a "ab" in it but it doesn't contain 
"ab" between < and >.

For example:

"zzz <> ttt> ab" - matches
"z ab <tt> xx" - matches
"zzz ab <>ab> tt" - doesn't match
"ab <a x> <ab>" - doesn't match

I've done it by using 2 regular expressions, but I was searching for a solution 
for doing using only a single regular expression.
Is it possible to test the existence of a string and the non-existence of 
another string using a single regular expression?

I've tried using (?=...) and (?!...) but these 2 expressions can be used only 
if I know where in the string I want a certain string to appear or not to 
appear.

Octavian


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to