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

Top Page

Reply to 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 #6 from Elliott Hughes <enh@???> ---
> Implement -E, -G, and -P as suggested, and also do my original idea of a
> build-time option for selecting which is the default. Then recommend very
> strongly that if the default is not -P, the program should not be installed
> as pcre2grep, but as something else, e.g. grep. I could live with that.


yes, that sounds fine.

> One other thing occurred to me: in GNU grep, --include and --exclude take
> GLOBs as their arguments. pcre2grep does not - it uses Perl regexes, just
> like the patterns it matches. So do we need an option for that too? (The
> convert features of PCRE2 are a very recent addition - pcre2grep dates back
> to the original pcregrep of 20 years ago.)


that probably doesn't matter. certainly i don't see any scripts currently that
are using --include/--exclude, and the BSD grep we used in every Android
release that had grep doesn't support them.

> 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...


hmm, yeah, that might be more of a problem. (just today i was looking at a
script that used -o, although it seems like GNU grep has had problems there too
from the comments in the script!)

> 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.


yeah, maybe you're right. certainly the BRE/ERE behavior is going to matter to
far more people (and their scripts) than -P. so if PCRE can't give exact
BRE/ERE semantics this seems like it's doomed to failure. in which case i'll go
back to my original plan of sticking to BSD grep until toybox grep gets to the
point where we can switch to that.

on the good news front, i've updated AOSP master to PCRE 10.31.

(insert grumble here about there not being a -announce@ mailing list for me to
subscribe to, nor a github mirror that would let me programmatically query for
new releases...)

thanks for your time though!

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