Sheri wrote:

> Beta 2
> 

After a few weeks with the beta2 plugin I've characterized a repeating 
issue that affects script portability. I can't say it's a bug, so I call 
it a gotcha. It may force you to change some of your old scripts. The 
script fragment below exemplifies:

local prop =file.readall("file.ini")
/*
PORTABILITY NOTE:
 use    //REGEX1 -marked lines for regex.dll standard distro
 use    //REGEX2 -marked lines for new pcre-enhanced regex.dll plugin

*/
//REGEX1 prop[?"(?#1)(?m)(^\s*;.*\n)*"]="" // remove ; comments
//REGEX2 below: 1 line
prop = regex.pcrereplace(?"(?m)(^\s*;.*$)",prop,"") // remove ; comments

So, with the standard regex.dll, the replacement in REGEX1 above strips 
off all lines that start with a semicolon, such as comments in powerpro 
script and CL configuration files.

The new beta plugin should be fully compatible with the standard plugin, 
but really REGEX1 doesn't match anything in the example above when the new 
plugin is loaded. You need to replace REGEX1 with REGEX2 to achieve the 
same result.

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.

The subtle point is that you will only see this problem with strings 
returned by file.readall (CRLF), a LF-only strings masks this issue.

Reply via email to