Subject: Re: macOS git grep change in required character classes

From: Junio C Hamano <[email-masked]>
Date: Sat, 01 Apr 2023 10:56:10 -0700

Matt Gardner <[email-masked]> writes:

> Even though the grep that ships with macOS is GNU compatible?
>
> $ which grep
> /usr/bin/grep
> $ grep -V
> grep (BSD grep) 2.5.1-FreeBSD
> $ grep -E \\btest\\b test.pl
> sub test { return; }

It seems that use of REG_ENHANCED bit (which gives some GNUism
enhancement to regex engine of BSD origin) is inconsistent even
among tools shipped by Apple,

cf. https://lore.kernel.org/git/[email-masked]/

which may even contribute to the confusion.

I think we recently (of course this is after we stopped doing
NO_REGEX and switched to macOS native regex library) started using
the ENHANCED bit only for BRE and we do not use ENHANCED bit for
ERE, and the cited thread (which has "pcre" on the subject, but it
turns out that the symptom had nothing to do with pcre) discussed
possible use of the same enhanced bit for ERE by us.