[pcre-dev] [Bug 1565] pcregrep doesn't correctly anchor star…

Pàgina inicial
Delete this message
Autor: Nicolas Sitbon
Data:  
A: pcre-dev
Assumpte: [pcre-dev] [Bug 1565] pcregrep doesn't correctly anchor start of subject
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1565




--- Comment #5 from Nicolas Sitbon <nicolas.sitbon@???> 2014-12-30 18:36:55 ---
(In reply to comment #4)
> On Tue, 30 Dec 2014, Nicolas Sitbon wrote:
>
> > As far as I know only pcregrep allows the multiline mode other programs match
> > line by line.
>
> That is true, but in some sense it still matches "line by line". It does
> *not* do one ginormous match on the whole file (see below).
>
> > This is weird to allow the subject to span multiple lines without
> > honoring the right behaviour for the anchor \A.
>
> I am not sure what you mean by "the right behaviour". Down at the
> library level, when pcre_exec() is called, \A means "match at the start
> of the subject string". What pcregrep does is to pass pcre_exec() a
> subject string that starts at the start of a line. If -M is set, further
> lines are also included in the subject string. If the match fails,
> pcregrep moves on to the start of the next line (as all greps do) and
> tries again.
>
> As far as I can see, the is consistent behaviour with and without -M; \A
> always matches at the start of the line that pcregrep is considering.
> All that -M does is to allow the match to continue over the end of the
> line.
>
> What do you think \A should do?
>
> Philip
>


with the -M I was expecting the subject string to be the whole file even if you
split it internally in chunk of buffer size. I'm really looking for a program
that can match in a whole file and not just line by line.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email