[thelist] Perl Regex

Raymond Camden jedimaster at macromedia.com
Thu Apr 5 11:24:00 CDT 2001

This should work for you:

<CFSET STR = "Foo foo <title>This is the title</title> you blah">
<CFSET Title =
REReplaceNoCase(STR,".*(<[ ]*t[ ]*i[ ]*t[ ]*l[ ]*e>)([^>]*)(<[ ]*/[ ]*t[ ]*i
[ ]*t[ ]*l[ ]*e[ ]*)>.*","\2")>

It should check funky title tags like:   < Ti  tle>. However, it won't find:


You can make that work by changing [ ]* to [ #Chr(10)#]*. That _may_ do it.
Actually, you may want to add the tab character in there as well.

As for the docs - In CF 4.01 the docs were _much_ better for CF's regex. I
don't have a URL handy, but I know you can find the 4.01 docs online.

Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email   : jedimaster at macromedia.com
ICQ UIN : 3679482

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

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Bruce Heerssen
> Sent: Thursday, April 05, 2001 11:58 AM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] Perl Regex
> Can anyone provide a method for doing the same in ColdFusion? I'm
> currently
> doing this with a less efficient method ( #listGetAt('<TITLE>Test
> title</TITLE>', 2, "<>")# )
> The problem with this is that a) it uses list functions which may
> not be as
> efficient as regexps -- which is important for my application --
> and b) if the
> list contains only one element, then the code bombs.
> Also, if anyone has some links to good resources for using
> regexps in CF, I
> would be eternally grateful. The CF docs are a little sparse in
> this department.

More information about the thelist mailing list