--- In [email protected], sgp <[EMAIL PROTECTED]> wrote: > The reason is that file.readall returns a CRLF separated string. > Contrast that to a LF-only separated line as returned, for > instance, from vec.makelines. The regex in REGEX1 matches both > cases CRLF and LF-only, but the new beta plugin doesn't - with > the same expression.
Hi sgp, That is not resulting from the plugin, but from the pcre.dll default newline. What you have in your original (multiline) pattern asks for a dot to precede your \n. When "LF" is the pcre default newline, and your data has carriage returns before each line feed, dot matches them. But now we have "ANYCRLF" as the pcre default newline. Your old pattern would work if you gave it an option for LF (IOW, treat this CRLF file as if it were an LF type file). But the old functions don't support special options. You would need to get rid of the dot in pattern, where you expect it to match a carriage return. Use "\r?" in front of "\n". That should work with files having CRLFs as well as ones have LFs only. Or if you know you have CRLFs use "\r\n". A dollar sign represents the end of a line before the linebreak, so if you use that, the linebreaks are going to be excluded from the matches. Using a dot when you want a specific character is rarely a good idea. A dot can match anything; it was previously matching your carriage returns because of the unique situation of a multiline line pattern (?m) applied to input having CRLFs, when the pcre default newline was LF. >From the help file: "The included 7.1 pcre.dll has been configured with a default newline option called ANYCRLF. When multiline patterns are searched, newlines in Windows, Unix and Mac formatted text files should work properly. The PCRE library included with older versions of the posix-only regex plugin used Unix-only style newlines. Since the posix functions do not support runtime options, some rare user patterns used with them may need to be revised to work properly with the new default of ANYCRLF. For example, using a multiline pattern containing dot dollar with a PCRE library having a newline default of LF, the dot would match a carriage return; now it will match the last character before the carriage return." Regards, Sheri
