Re: [pcre-dev] /x modifier bug when using # comments in RE ?

Top Page
Delete this message
Author: ph10
Date:  
To: GAUTIER Herve
CC: pcre-dev@exim.org
Subject: Re: [pcre-dev] /x modifier bug when using # comments in RE ?
On Mon, 9 Jun 2014, GAUTIER Herve wrote:

> From my point of view, minor remaining problems are:
> - Impossible to enter the sequence CR LF when defining RE using pcretest.


It does seem impossible interactively, but you could of course have it
in a file.

> - Impossible to choose independently the newline for RE and DATA.


That is not correct. You can set any of the PCRE_NEWLINE_xxx options
either for pcre_compile() or pcre_exec().

> - I still do not understand why when PCRE is compiled with
> --enable-newline-is-crlf on a system (Linux) which has LF as newline,
> using /x modifier, PCRE lib or prcetest ignored the newlines (LF) in
> my RE:


It did not ignore them. It treated them as white space, but *not* as
newlines.

> --8<------------------------------------------------------------------
> $ pcretest
> PCRE version 6.6 06-Feb-2006
>
>   re> /^
>     >               [+-]?
>     >               (
>     >                       \d+\.\d+
>     >                     |\d+\.
>     >                    |\.\d+
>     >              )
>     >              ([eE][+-]?\d+)?
>     >              $/xm
> data> START\r\n1.2E3\r\nEND
>  0: 1.2E3\x0d
>  1: 1.2
>  2: E3
> data>
> --8<------------------------------------------------------------------

>
> Here it matches, I don't know why. In my opinion, it should not
> because I have defined newline as CR LF at library compilation time,
> so when I press Return key, a LF is enter in my RE but this LF is
> ignored (by PCRE library or prcetest program).


You have set the /x modifier; this ignores all white space.

Philip

--
Philip Hazel