[thelist] Regex, dynamic replace and problem with numbers.
Plunkett, Matt
MPlunkett at MSA.com
Tue Mar 12 15:14:00 CST 2002
You may have hit on a CF specific problem. I converted your code to Perl
and it works fine:
#!perl -w
use strict;
my $str = "23 Main St";
my $container_str = "<input type=\"Text\" name=\"Address\" value=\"\" />";
$container_str =~ s/([^>]* value="?)([^"\s]*)(["\s>][^>]*>)/$1$str$3/;
print $container_str;
I couldn't get it to work in CF unless I changed the 23 to "foo" or some
other string.
HTH,
Matt
-----Original Message-----
From: Raymond Camden [SMTP:jedimaster at macromedia.com]
Sent: Tuesday, March 12, 2002 3:51 PM
To: 'Plunkett, Matt'
Subject: RE: [thelist] Regex, dynamic replace and problem
with numbers.
<input type="text" name="address" value="23 Main St.">
Basically, moving sValue into value=""
=======================================================================
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
> -----Original Message-----
> From: Plunkett, Matt [mailto:MPlunkett at MSA.com]
> Sent: Tuesday, March 12, 2002 3:49 PM
> To: 'Raymond Camden'
> Subject: RE: [thelist] Regex, dynamic replace and problem
> with numbers.
>
>
> What is the desired output?
>
> -----Original Message-----
> From: Raymond Camden [SMTP:jedimaster at macromedia.com]
> Sent: Tuesday, March 12, 2002 3:35 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] Regex, dynamic replace and
> problem with
> numbers.
>
> 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
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
More information about the thelist
mailing list