Duane,

First off your regex probably needs to account for characters other than
A-Z - try

<title>[^<]*</title>

which will match anything other than the opening '<' of the end </title>.

Second, there is a confirmed bug in all current versions of CF.  The
ReReplace command is restricted to 20480 characters (20k) for the input
string - if you go beyond this you get a message saying 'bad regular
expression' or something similar. Seeing as how you're working with HTML
documents you might find that you reach this limit.  I haven't had chance to
beta test CF5 yet so can't tell you whether it's been fixed.  It was
reported as a bug in CF4.

This may be a reason why your regex appears to be 'bad' even if it's 'good'.

One workaround is to use FindNoCase("<title>"), FindNoCase("</title>"), do
the maths and a mid function to find the title text, then replace the title
text with your own text, #PageTitle#, since the standard replace function
works fine.

Keith

> -----Original Message-----
> From: Duane Boudreau [mailto:[EMAIL PROTECTED]]
> Sent: 05 March 2001 14:34
> To: CF-Talk
> Subject: Reg Expression
>
>
> I'm trying to replace the text between the <title></title> tags with a new
> string
>
> ReReplaceNoCase(templatefile,
> "<title>[A-Z]*</title>","<title>#PageTitle#</title>", "ALL")
>
> What am I doing wrong? (I really am bad with reg expressions)
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to