in reply to Regex: negative look ahead
If the goal here is to do things with strings which do not match a pattern, don't try to use a negative look-ahead -- just negate the test:
my @strings = ( "ERROR blah license will expire", "ERROR blah something else", "ERROR blah Error processing Cancel Execution", ); foreach (@strings) { if (!($_ =~ /^ERROR.+?(Error processing Cancel Execution|license w +ill expire)$/)) { print "Do something with '$_'\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex: negative look ahead
by johngg (Canon) on Apr 10, 2012 at 12:43 UTC | |
|
Re^2: Regex: negative look ahead
by fcaw1 (Initiate) on Apr 10, 2012 at 12:32 UTC | |
by brx (Pilgrim) on Apr 10, 2012 at 14:37 UTC |