I am using reMatch() to find a series of numbers within a string. My
regex pattern works correctly. I know that the pattern will only return
one set of seven consecutive numbers.
<cfoutput>#reMatch("[0-9]{7}", ";00002720?")#</cfoutput>
Returns 0000272 as expected.
The problem occurs when I try to reference the first, and only, index in
the array returned from rematch().
Since reMatch() returns an array, I thought I could do this:
reMatch("[0-9]{7}", ";00002720?")[1]
However, that doesn't work.
I have to store the array in a temp variable, then reference the first
index.
<cfset tempArray = reMatch("[0-9]{7}", ";00002720?")>
<cfoutput>#tempArray[1]#</cfoutput>
Is there another solution so that I don't have to store the array in a
temp variable just to get to the value?
Thanks
Mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:313689
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4