Like this?
\[[[:alnum:]]*:[[:alnum:]]*\]
a bracket followed by any number of letters or numbers followed by a colon followed by 
any number of letters or numbers followed by a close bracket.
or this?
\[[^]]*\]
A open bracket followed by any number of characters that are not a close bracket 
followed by a close bracket
Both of them test out correctly with your example below


> Here is an example:
> 
> I'm trying to remove the [Tag:Value] in the string below:
> 
> ----
> <cfset text="This is some [Tag:Value] text">
> 
> <cfset regex="\[[^\]]*:[^\]]*\]">
> <cfset newText=REReplaceNoCase(text,regex,'','ALL')>
> 
> <cfoutput>#newText#</cfoutput>
> ----
> Running this, newtext=text.
> 
> However, if I change it to the following:
> 
> ----
> <cfset text="This is some {Tag:Value} text">
> 
> <cfset regex="\{[^\}]*:[^\}]*\}">
> <cfset newText=REReplaceNoCase(text,regex,'','ALL')>
> 
> <cfoutput>#newText#</cfoutput>
> ----
> 
> newtext now is "This is some  text" as you'd expect it to be.
> 
> 
> Thanks for any ideas,
> 
> Matt
> 
> 
> -----Original Message-----
> From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 27, 2002 2:31 PM
> To: CF-Talk
> Subject: Re: CF Regex problem
> 
> 
> I haven't seen such a problem in the past. If you can post your RegEx we can look it 
>over and test it.
> 
> > Hi there,
> > I'm having a problem in CF5 - if I try to use a regular expression to match a 
>pattern that contains either the [ or ] characters, the find fails. I've already 
>tried escaping each and using ascii character codes instead of the actual character, 
>but I can't seem to make it work.
> > 
> > If I change the text to use ( and ) or { and } and escape them properly, the regex 
>find works as expected.
> > 
> > Is this a known problem? Is there a workaround?
> > 
> > 
> > Thanks,
> > 
> > Matt
> > 
> > 
> 
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to