git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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é
Previous: demerphqNext: Junio C Hamano
Message 7 of 18 in “git bug: Perl compatible regular expressions do not work as expected”
  1. Mario GrgicMar 25, 2023
  2. Kristoffer HaugsbakkMar 25, 2023
  3. Mario GrgicMar 25, 2023
  4. demerphqMar 25, 2023
  5. Mario GrgicMar 25, 2023
  6. demerphqMar 25, 2023
  7. René ScharfeMar 25, 2023
  8. Junio C HamanoMar 27, 2023
  9. René ScharfeMar 27, 2023
  10. Junio C HamanoMar 27, 2023
  11. Junio C HamanoMar 28, 2023
  12. René ScharfeMar 28, 2023
  13. Mario GrgicMar 25, 2023
  14. Mario GrgicMar 25, 2023
  15. Junio C HamanoMar 27, 2023
  16. Mario GrgicMar 27, 2023
  17. Junio C HamanoMar 27, 2023
  18. Mario GrgicMar 28, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.