Hi;
I'm having trouble figuring out why some of my regular expressions
don't work in CF 4.5.
For example, say that I've read the HTML content of a Web page
into a string variable and now I want to perform a search and
replace on that variable. For simplicity's sake, let's say that I want
to get rid of everything between and including the HEAD tags.
In Perl, etc., the expression that would identify this text would be
something like:
<HEAD>.*</HEAD>
That is, a head tag followed by any character, followed by one or
more of those "any" characters, until a closing head tag is
reached. (This assumes that my Perl script has been designed to
examine the whole variable at once, rather than line by line--CF
does this by default, according to its docs).
But when I try a line like the following in CF, the regular expression
parser returns an error:
<CFSET my_string = REreplacenocase(mystring,
"<HEAD>.*</HEAD>", "")>
I thought it might be because the brackets or backslashes are
reserved characters, but the CF docs say they aren't. To test this, I
tried:
<CFSET my_string = REreplacenocase(mystring, "<HEAD>.*", "")>
Which behaved as expected and removed everthing in the string
from the HEAD tag on (including the HEAD tag itself).
Apparently any time you add an end boundary to the expression,
ColdFusion chokes.
Am I misunderstanding something, or is this a deficiency in CF's
regular expression parser? If so, does anyone know of a
workaround?
Thanks,
Melinda
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.