[pcre-dev] [Bug 2294] pcregrep -E

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2294] pcregrep -E
https://bugs.exim.org/show_bug.cgi?id=2294

--- Comment #5 from Philip Hazel <ph10@???> ---
Yet another thing has occurred to me: the POSIX BRE/ERE specifications mandate
a longest match, but Perl regexes find the first, leftmost match. You might not
think this matters for a grep, but it does if the -o option is used:

$ echo "This is a catastrophe" >zz
$ pcre2grep -o 'cat|catastrophe' zz
cat
$ grep -oE 'cat|catastrophe' zz
catastrophe
$

I'm beginning to wonder whether trying to make pcre2grep appear to mimic grep
might not be such a good idea after all. There are really quite a lot of
differences. And the whole point of pcre2grep (and its predecessor pcregrep)
was to be a distinctive *Perl-style* grep.

--
You are receiving this mail because:
You are on the CC list for the bug.