bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22655: grep -Pz '^' now fails!


From: Stephane Chazelas
Subject: bug#22655: grep -Pz '^' now fails!
Date: Fri, 18 Nov 2016 17:06:36 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2016-11-18 08:48:04 -0800, Paul Eggert:
> Stephane Chazelas wrote:
> >Why would it make it slower. AFAICT, PCRE_MULTILINE *adds*
> >some overhead.
> 
> As I understand it, PCRE_MULTILINE lets 'grep' apply a pattern to an
> entire buffer that contains many lines, and this lets PCRE
> efficiently find the first match in the whole buffer. If grep
> doesn't use PCRE_MULTILINE, grep would have to apply the pattern to
> each line separately, which could be significantly slower.
[...]

That might have been the case a long time ago, as I remember
some discussion about it as it explained some wrong information
in the documentation, but as far as I and gdb can tell, grep
2.26 at least call pcre_exec for every line of the input with
grep -P.

If it didn't

echo test | grep -P '\n$'

would match.

I'll try and dig up the old discussions.

-- 
Stephane





reply via email to

[Prev in Thread] Current Thread [Next in Thread]