--- In [email protected], Julien Pierrehumbert <[EMAIL PROTECTED]> 
wrote:
>
> swzoh wrote:
> > BTW, I'm not sure why the following two output different results:
> > 
> > esc(?"\r\nGoodbye\r\n\r\n",?"\").replaceg(?"(?m)^\R", ?"Hello\0") 
> > esc(?"\r\nGoodbye\r\n\r\n",?"\").replaceg(?"(?m)(?<=^)\R",
> > ?"Hello\0")
> 
> I assume you're using the "any" PCRE build. In that case, I suppose one
> of your expressions matches \n while the other doesn't in "Goodbye\r\n".
> You'd have to do more testing to find out why but this is probably a
> PCRE issue. I don't know what the expected result would be... maybe you
> found a bug so that may be worth investigating (to minimize plugin
> interference, don't use the global services).

Yes, I used ANY version. And, I further tested replacing the second \r\n
with \n\n or \n\r or \r\r
and tested with also lookahead (?=^)\R.
I tested by directly calling pcreposix.dll using the wrapper script I
wrote before.

The only strange result, which might actually be the desired result,
came from only \r\n and lookbehind.

The explanation I could think of is following:
If lookbehind is involved, it somehow interferes the engine so that it
detects CRLF, meaning ^ and $ never match inside/between CR-LF pair.

What I'm not certain is, then, which side the bug resides on. In other
words, whether \r\n is supposed to be treated as a single entity in
ANY case too as in CRLF version, or NOT.

In this regards, somewhat discouraging result was:
esc(?"Bye\r\n\r\n",?"\").replaceg(?"(?m)(?<=^)(?:\n|\r)",?"Hello\0")
which produced
Bye\r\nHello\rHello\n

Sean

Reply via email to