Original string: "\r\nGoodbye\r\n\r\n"

regex applied to put "Hello" on empty lines

Result with 1.5.2 and PCRE 7 "any":

Hello\r\nGoodbye\rHelloHello\nHello\r\n

Julien said: -the last empty line doesn't match because the plugin
doesn't even try as the string has now been fully consumed (is that
yet another bug?)

I'm struggling to understand what you're saying. There were two empty
lines in the input string. Surely the last "Hello" in the replacement
is there because it matched the last one?

I think the problem producing the \rHelloHello\n (of which only the
\r\n should be in the output) is another anomoly of sending shortened
strings instead of offsets to PCRE. The metacharacter ^ normally
matches not only the beginning of lines in multiline mode, but also
the beginning of the input string. There is the option PCRE_NOTBOL
which is available to the posix interface which I think should be set
after the first match in a global operation. Could you verify if that
is not currently happening in the plugin and could we possibly try one
where it is?

Regards,
Sheri




Reply via email to