Reputation: 55
I have the following text: "my brother drunk 7 cups of coffee and then printed his homework in A4 paper. He then drove down the I-90 highway."
I want to extract only the numbers of the text (in this example 7,4,90). How can I do this with coldfusion?
I suspect the REMatch function must be used but I am not good with regular expressions, I appreciate everyone's help.
Upvotes: 4
Views: 4391
Reputation: 2019
Just use rematch and this will return array of match numbers.
<cfset str = "my brother drunk 7 cups of coffee and then printed his homework in A4 paper. He then drove down the I-90 highway">
<cfset arrSearch = rematch("[\d]+",str)>
<cfdump var="#arrSearch#">
Upvotes: 13