in reply to stupid question about regexp - not matching a word
Are you trying to match "nevermind" only if not preceded by "abc"? If so, you may want something like this, which uses negative lookbehind:print unless /\babc\b/;
Are you trying to match every word except "abc"? If so, you may want something like this:print if /(?<!abc )nevermind/;
my @words = grep !/^abc\z/, split; print "@words";
-- Mike
--
just,my${.02}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: stupid question about regexp - not matching a word
by december (Pilgrim) on Jul 15, 2002 at 22:21 UTC | |
by thelenm (Vicar) on Jul 15, 2002 at 23:04 UTC | |
by december (Pilgrim) on Jul 16, 2002 at 00:41 UTC | |
by Abigail-II (Bishop) on Jul 16, 2002 at 11:55 UTC |