Perl extended regexp problems...
wesley at yelsew.com
Sun Sep 16 07:51:33 CDT 2001
On Sun, Sep 16, 2001 at 10:12:30AM +0100, Liyang Hu wrote:
> liyang at sakura:~$ echo -e "foobar\ncowbar\ncowmoo" \
> | perl -ne 'print if /(?<!=cow)bar/x'
> liyang at sakura:~$
> I've read the FM, and my interpretation of that pattern is ``match
> all occurrences of `bar' not immediately prefixed by `cow'.''
> Shouldn't the answer be just `foobar'?
> How am I supposed to do this? (given the constraint that you've
> only got one regex to accomplish the task...)
Do you have a superfluous equals sign in there...? /(?<!cow)bar/
More information about the Belfast-pm