Can you provide one more of the actual links? I'm going to assume that the
folderName string is not actually 'folderName'. If that's the case then it
would affect the regular expression and what it would need to look for. Will
the two character string always be at the end of the link?

If everything else is the same, and you just need the last two characters of
a link:

<cfset string = '../folderName/someCFMFile.cfm?code=AB'>
<cfset match = REMatchNoCase('[A-Z]{2}$',string)>
<cfdump var="#match#">
<cfabort>



-----Original Message-----
From: Robert Nurse [mailto:rnu...@gmail.com] 
Sent: Tuesday, May 12, 2009 11:20 AM
To: cf-talk
Subject: Help With Regular Expressions


Hi All,

I'm trying to find a way of using regular expressions to locate and replace
text.  My application reads in some text containing links from a DB: e.g.
../folderName/someCFMFile.cfm?code=AB.  I want to change all occurrences of
this to ../folderName/AB.html.  Note that "code" can be any
2-uppercase-character combination.  I've gotten to the point where I have
../folderName/code using:

<cfset aData = Replace(stringFromDB, "someCFMFile.cfm", "", "ALL")> <cfset
aData = REReplace(aData, "../folderName/[A-Z]{2}", aData, "ALL")>


My problem is how to get it to replace what it matches with that same match
(which would be ../folderName/code) with ../folderName/code.html? 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322429
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to