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

Re: [PATCH] grep -P: Fix matching ^ and $

From
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date
Feb 25, 2012, 17:52 UTC
Message-ID
<4F491FF8.9070609@in.waw.pl>
In-Reply-To
<20120225103050.14f52a91@gmail.com>
On 02/25/2012 10:30 AM, Michał Kiedrowicz wrote:
Show 8 quoted lines
> Michał Kiedrowicz<michal.kiedrowicz@gmail.com>  wrote:
>
>> When `git-grep` is run with -P/--perl-regexp, it doesn't match ^ and $ at
>> the beginning/end of the line.  This is because PCRE normally matches ^
>> and $ at the beginning/end of the whole text, not for each line, and git-grep
>> firstly passes a large chunk of text (possibly containing many lines) to
>> pcre_exec() before it splits the text into lines.  This makes `git-grep -P`
>> behave differently from `git-grep -E` and also from `grep -P` and `pcregrep`:
Thanks! I can confirm that I now get the expected output.
Zbyszek
> Original report:
> http://permalink.gmane.org/gmane.comp.version-control.git/190830
Previous: Michał KiedrowiczNext: Junio C Hamano
Message 3 of 6 in “grep -P: Fix matching ^ and $”
  1. grep -P: Fix matching ^ and $Michał Kiedrowicz, Feb 25, 2012
  2. Michał KiedrowiczFeb 25, 2012
  3. Zbigniew Jędrzejewski-SzmekFeb 25, 2012
  4. Junio C HamanoFeb 26, 2012
  5. grep -P: add tests for matching ^ and $Zbigniew Jędrzejewski-Szmek, Feb 27, 2012
  6. Junio C HamanoFeb 27, 2012

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.