Re: [pcre-dev] Question about .*

Top Page

Reply to this message
Author: Giuseppe D'Angelo
To: Vicente Ferrari
CC: pcre-dev
Subject: Re: [pcre-dev] Question about .*

On Mon, 10 May 2021 at 21:42, Vicente Ferrari via Pcre-dev
<pcre-dev@???> wrote:
> Hello, sorry to bother with a basic question.
> I'm wondering about the expected result when matching ".*" against a string
> with new lines.
> I compiled PCRE2 with the ANYCRLF option, expecting that the pcre2demo.c
> program would
> basically completely ignore those newlines. Instead, I get matches of
> length 0 at the index of the
> \r, no matches where \n is and then the next correct match starts at the
> correct offset, taking into account the length 2 of the newlines.
> I was expecting newlines to produce no matches at all, am I doing something
> wrong?

It's hard to say without any testdata; could you please share some
examples of the patterns that you're using, and the corresponding
subject strings that seem to match at unexpected places?

Giuseppe D'Angelo