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

Raymond Camden jedimaster at macromedia.com
Tue Mar 12 14:36:00 CST 2002

Anyone know of a good solution to this issue:

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

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

The code is CFML, but this applies to any regex system. In general, the
issue is that the '23' in sValue inteferes with the \1 backreference.
Anyone know a way around this? Oh, and yes, I know I can put in some
temp var like chr(1) instead of sValue, but I'd like to know if a 'pure'
solution exists.

Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email    : jedimaster at macromedia.com
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda

More information about the thelist mailing list