Sagewire Logo

regex variables in rereplace

4 Message(s) by 3 Author(s) originally posted in advanced cfml techniques


From: ogre11 Date:   Wednesday, October 24, 2007
Is it possible to use regex variable s with rereplace? For instance if I wanted
to put brackets around the area code in a phone number, I'd like to do the
below code, but it doesnt work, just sees the variable as a string
rereplace(someNumber, "([\d]{3,3})", "($1)")


From: Grizzly9279 Date:   Wednesday, October 24, 2007
I believe you can back-reference matched substrings with the backslash character (instead of the dollar sign).

You will probably find this article helpful:
http://www.petefreitag.com/item/517.CFM


From: ogre11 Date:   Wednesday, October 24, 2007
awesome, thanks


From: Adam Cameron Date:   Wednesday, October 24, 2007
You'll probably find this article helpful:
http://www.petefreitag.com/item/517.CFM



The official docs are more comprehensive (and a good place to START when
one has a query about CF):

http://livedocs.adobe.com/Cold Fusion/8/htmldocs/regexp_01.html#1100400

Livedocs are pretty good, these days.
--
Adam



Next Message: There are three folders. fbx_settings.cfmdsp_recommendation.CFM Mainsubmenu.CFM how do they worktogether?



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional