in reply to regex help needed

Here's a two step approach to accomplish the task.

Change your if statement to be:

if ((/Exception/i) && !(/Exception Handler/i)) { print "FOUND : $_\n"; }

Might not be elegant, but it gets the job done. If you prefer to use a singe regex, I'd probably go with what Eliya posted.

Replies are listed 'Best First'.
Re^2: regex help needed
by locked_user sundialsvc4 (Abbot) on Mar 28, 2011 at 19:30 UTC

    And I’d go with what you did ... an if statement ... purely on “the next-time principle.”   The one and only thing you can be sure of is change, so make the code as easy as possible to change next-time.   A “clever” regex might be difficult to change – and soon enough a change might well will come along soon for which it is impossible.   It’s really only a matter of time.   Conditional logic, which does not place the full responsibility upon a single regex but merely obliges it “to get us into the right neighborhood,” will be much more forgiving of change in the long run.