Thanks Wil and Adrian: Looks like there are many different hacks to suit 
different purposes. I have simply used a temporary escape character that I 
convert back with an extra line. It would indeed appear that CF regexp just 
falls short.

-----Original Message-----
From: Wil Genovese [mailto:[email protected]]
Sent: 13 January 2009 17:53
To: cf-talk
Subject: Re: RegExp - how to escape a zero

Here is a hack work around using REFind to return a struct of arrays
containing the match locations then doing string manipulation to replace the
parts you want to replace.  The downside is it will only work on the first
occurrence of the match in the string.  I can not find any other way to make
the regex substituion work without inserting a comma.  Which in the end may
be acceptable in your case.  Welcome to the world of CF flavored RegEx.


<cfset testString = "house in clapham 200k with garden">
<cfset pattern = "(\d+)(k)">
<cfset sMatchPos = refindNoCase(pattern,testString,1,"True")>
<cfset newstring =
removeChars(testString,sMatchPos['pos'][3],aMatchPos['len'][3])>
<cfset newstring = insert("000",newstring,sMatchPos['pos'][3]-1)>
<cfoutput>#newstring#"</cfoutput>


Wil Genovese




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317891
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to