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

Αρχική Σελίδα
Delete this message
Συντάκτης: GAUTIER Herve
Ημερομηνία:  
Προς: pcre-dev@exim.org
Αντικείμενο: Re: [pcre-dev] /x modifier bug when using # comments in RE ?

On 06/06/2014 13:37, ph10@???<mailto:ph10@hermes.cam.ac.uk> wrote:

On Fri, 6 Jun 2014, GAUTIER Herve wrote:

> In my opinion, no. As I have used the pcretest program in a xterm on
> Linux, only a \n is added when I press the return key


Then why did you configure with

PCRE_CONFIGURE_OPTS += --enable-newline-is-crlf

?? On Linux, as you say, newlines are just LF, but that configuration
specifies that lines are terminated with two characters (CR, LF). So a
single LF character will not be treated as indicating a newline.

Sure.
I need --enable-newline-is-crlf because the data that I match is a protocol where the end of line is CR LF.
But my regex editor is on Linux thus end of line are LF.
I was thinking (I don't know why...) that --enable-newline-is-crlf affects only the data, not the definition of the regex, and particularly when using /x modifier with comments in regex.
Maybe I should use --enable-newline-is-anycrlf or "automagically" add CR before LF in my regex definition.

How test with pcretest using my configuration ? Can I put CR in my RE ? Is pcretest take in account the --enable-newline-is-* while entering the RE ?

$ pcretest
PCRE version 8.34 2013-12-15

re> /^\r

    >                   [+-]? # test\r
    >                          \d+\.\d+\r
    >                          |\d+\.\r
    >                          |\.\d+\r
    >                    )
    >                    ([eE][+-]?\d+)?\r
    >                    $/xm\r
** Unknown modifier '\'
   re> /^\r
    >                   [+-]? # test\r
    >                          \d+\.\d+\r
    >                          |\d+\.\r
    >                          |\.\d+\r
    >                    )\r
    >                    ([eE][+-]?\d+)?\r
    >                    $/xm

data> START\r\n1.2E3\r\nEND

No match

Thank for your help and time Philip !

Rv

--
Hervé GAUTIER