ColdFusion has supported Regular Expressions for a while, but I've always missed a REMatch() function, one that would locate all matches and return them. Over the years several of us have written our own functions to do this, but that's no longer needed - REMatch() and REMatchNoCase() are both in
Scorpio.
Give us some examples, PLEASE! (Of course I can wait till you are in Lansing, and you can show us that also.)
<cfset arrMatches = REMatch( TEXT, REG_EX, SCOPE ) />
<cfloop index="i" from="1" to="#ArrayLen( arrMatches )#">
Match #i#: #arrMatches[ i ]#
</cfloop>
From Ben's description, it looks like it might not have a SCOPE param, but I thought it would be cool.
<!--- Find all the URLs in a web page retrieved via CFHTTP --->
<cfset result = REMatch("https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?", CFHTTP.FileContent)>
--- Ben
This is totally exciting. I can't wait to see all this in NYC later this month.
--- Ben
eg
http://www.abc.com/g/xxx-yyy-zzz/123456/v_content/1.jpg" target="_blank">http://www.abc.com/g/xxx-yyy-zzz/123456/v_content/...
result
http://www.abc.com/g/xxx
You said "Over the years several of us have written our own functions to do this, but that's no longer needed", can you give me an example or point me to one that I could reference? I created a string manipulation for CF8, but now need to build back to CF MX 6.1. I am having trouble with performance in all my trials, so any help would be greatly appreciated!
The script takes 3 seconds in CF8, but when I try to use a different script in CF MX 6.1, it takes alsom 50 seconds. The string input length varies, so I need good performance.
Thanks,
Dan