It would look something like this:
Find: (<cflocation url="[^"]+") ?/?>
Replace: $1 addtoken="true" />
This would capture anything that was like
<cflocation url="testPage.cfm" />
<cflocation url="testPage4.cfm"/>
<cflocation url="testPage2.cfm">
<cflocation url="testPage3.cfm" >
Hey again James,
Just came across this blog post
http://www.gskinner.com/blog/archives/2008/04/regexr_full_cod.html
The app is here
http://gskinner.com/RegExr/
It actually matches as you are typing your regular expression which seems perfect for someone learning regEx (or just needing to test something out before running it over and over again on the server).
Most of the regular expressions I'm starting with Eclipse itself. If you do a "Find" (and check the regular expressions checkbox), then press ctrl-spacebar it will bring up all possibilities for regular expressions. I actually had a bit of difficulty understanding what the $1 $2 $3, etc. was for and how to determine what is was replacing when I looked at the CF livedocs, but the hint box in Eclipse was very straightforward, and I got it right away. If there's something else I need though this site was great http://www.regular-expressions.info/ I haven't used it in a while, but it has quite a few useful items.
Comment Wall (7 comments)
You need to be a member of ColdFusion Community to add comments!
Join this network
It would look something like this:
Find: (<cflocation url="[^"]+") ?/?>
Replace: $1 addtoken="true" />
This would capture anything that was like
<cflocation url="testPage.cfm" />
<cflocation url="testPage4.cfm"/>
<cflocation url="testPage2.cfm">
<cflocation url="testPage3.cfm" >
and add the addtoken="true" to them all
Just came across this blog post
http://www.gskinner.com/blog/archives/2008/04/regexr_full_cod.html
The app is here
http://gskinner.com/RegExr/
It actually matches as you are typing your regular expression which seems perfect for someone learning regEx (or just needing to test something out before running it over and over again on the server).
(I forgot to add the "result" part to my redo post...sorry for all of the posts)
Hey James,
Just saw your comment about the cflocation token. Here's something you can try that may work.
I'm guessing that the tags without tokens should be formatted
<cflocation url="myPage.cfm" />
(or something close to that).
A RegEx that would add the addtoken attribute to all of those would be something like:
Find: (<cflocation url="[^"]+") />
Replace: $1 addtoken="true" />
This should take any cflocation tag that only has the url attribute and replaces that with
Hope this helps you out.