Szerző: ph10 Dátum: Címzett: GAUTIER Herve CC: pcre-dev@exim.org Tárgy: Re: [pcre-dev] /x modifier bug when using # comments in RE ?
On Tue, 10 Jun 2014, GAUTIER Herve wrote:
> Ok. So:
> - if PCRE_NEWLINE_xxx is used in pcre_compile() it set newline sequence
> only for RE
No. It also sets a default for data.
> - if PCRE_NEWLINE_xxx is used in pcre_exec() it set newline sequence
> only for DATA.
Yes.
This is all documented in the pcreapi page, which says this:
The only time that a line break in a pattern is specially recognized
when compiling is when PCRE_EXTENDED is set. CR and LF are white space
characters, and so are ignored in this mode. Also, an unescaped #
outside a character class indicates a comment that lasts until after
the next line break sequence. In other circumstances, line break
sequences in patterns are treated as literal data.
The newline option that is set at compile time becomes the default
that is used for pcre_exec() and pcre_dfa_exec(), but it can be
overridden.
> So pcretest ignores my newlines. That is not what I was expected to.
pcretest did not ignore them. It passed them to pcre_compile().