in reply to stupid question about regexp - not matching a word
I'm not sure I'm reading your question right, but you're wondering why [^(abc)] doesn't match the string abc?
The square brackets enclose an expression that will match one character. The construct you show will match anything other than (, ), a, b, or c. I think that's what your description is trying to say.
You can get the effect you want in Perl newer than 5.6.1 with a lookbehind assertion: print if /(?<!abc) nevermind/There are other ways to do it, using $PREMATCH, but this will work for fixed strings. More information at perlre, the section about lookbehind.</code>
That is, if I read your question correctly....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: stupid question about regexp - not matching a word
by december (Pilgrim) on Jul 15, 2002 at 22:15 UTC | |
by Abigail-II (Bishop) on Jul 16, 2002 at 11:52 UTC |