in reply to stupid question about regexp - not matching a word
s/\babc\s+//;Option B: Print only lines without "abc" in them:
print unless /\babc\b/;Note that the use of \b indicates that there should be a "word-boundary" there. This prevents accidental matches of things like "abcd" or "cbabc".
print if /(\w+) nevermind/ && $1 ne "abc";You could get fancy with look-behind assertions or embedded code, if you desire. See: perlre
print if /(?<!abc) nevermind/;I think this last one is what you were trying for.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Negative Look-behind Assertion
by december (Pilgrim) on Jul 15, 2002 at 22:12 UTC |