Re: git bug: Perl compatible regular expressions do not work as expected
- From
René Scharfe <l.s.r@web.de>
- Date
- Mar 25, 2023, 18:09 UTC
- Message-ID
- <eba23dc4-c036-fd1b-a1f0-028e8fff602b@web.de>
- In-Reply-To
- <MW4PR20MB5517888E63C13099E284B97590859@MW4PR20MB5517.namprd20.prod.outlook.com>
Am 25.03.23 um 14:09 schrieb Mario Grgic:
Show 5 quoted lines
> The lowercase -p is to print the output in patch format. You can rewrite the command line as > > git log --all --patch --perl-regexp -G '\bmain\b’ > > I still get no output in any git version after 2.38.4
-G doesn't support Perl regular expressions. --perl-regexp only affects --grep, --grep-reflog, --author, and --committer. Neither POSIX basic nor extended regular expressions support \b as word boundary. GNU regex and our compat/regex/ do, as extensions. macOS regex supports it if the flag REG_ENHANCED is given to regcomp(3).
So perhaps this is rather a feature request to support Perl regular expressions for -G (and probably -S as well). Or to enable REG_ENHANCED for them, at least, like 54463d32ef (use enhanced basic regular expressions on macOS, 2023-01-08) did to get alternations for git grep on macOS.
René