Perl extended regexp problems...

Liyang Hu liyang at nerv.cx
Sun Sep 16 08:48:58 CDT 2001


Hi,

On Sun, Sep 16, 2001 at 08:51:33AM -0400, Wesley Darlington wrote:
> On Sun, Sep 16, 2001 at 10:12:30AM +0100, Liyang Hu wrote:
> > echo -e "foobar\ncowbar\ncowmoo" | perl -ne 'print if /(?<!=cow)bar/x'
> Do you have a superfluous equals sign in there...? /(?<!cow)bar/

I do? O_O

Perl in a Nutshell (First Edition, December 1998) tells me:

----8<----

4.6.8 Extended Regular Expressions

(?<!=...)

    A zero-width negative lookbehind assertion. For example,
    /(?<!=bad)boy/ matches any occurrence of "boy" that doesn't
    follow "bad". This only works for fixed-width lookbehind.

----8<----

Grr... This is the last time I read the FM. -_-

^^;;;

/Liyang
-- 
.----| Liyang Hu /aka/ DenseBoy |---| http://www.nerv.cx/ |----.
|  drug, n: A substance that, when injected into a rat,        |
|    produces a scientific paper.                              |



More information about the Belfast-pm mailing list