[thelist] Regex, dynamic replace and problem with numbers.

Lindsay Evans lindsay at redsquare.com.au
Tue Mar 12 16:07:00 CST 2002


<snip>
> Anyone know of a good solution to this issue:
</snip>

The only way I could find around it was to change the RegEx so that the
double quotes for the value attribute became part of sValue:


sRegEx = "([^>]* value=?)(""[^""[:space:]]*"")([[:space:]>][^>]*>)";
sSource = "<input type=""Text"" name=""Address"" value="""" />";
sValue = """23 Main St.""";

sTmp = REReplaceNoCase(sSource, sRegEx, "\1#sValue#\3", "all");

Not sure if this is aesthetically pleasing as it could be, but it works :o)

In playing around with this, I realised that there is no way to escape the
backslash in a backreference in CF, is this just a Cold Fusion thing, or is
there no allowance for such wackiness in Posix RE?

--
 Lindsay Evans.
 Developer,
 Red Square Productions.

 [p] 8596.4000
 [f] 8596.4001
 [w] www.redsquare.com.au




More information about the thelist mailing list