Copy link to clipboard
Copied
Why does this not return the variable form.item_cost to equal:199.99?
<CFSET string1 = "Here we have $199.99 is the price">
<CFSET form.item_cost = "#reMatchNoCase("^\d{0,4}(\.\d{1,2})?$",string1)#">
I only want to match the first price it sees in the string and return that value as a numeric decimal.
Because you're anchoring the regex to the beginning and end of the string with ^ and $, you'll only match if the string in its entirey is the number.
I recommend using regex coach for testing this sort of thing. It makes it very easy to work this sort of thing out. http://www.weitz.de/regex-coach/
--
Adam
Copy link to clipboard
Copied
Because you're anchoring the regex to the beginning and end of the string with ^ and $, you'll only match if the string in its entirey is the number.
I recommend using regex coach for testing this sort of thing. It makes it very easy to work this sort of thing out. http://www.weitz.de/regex-coach/
--
Adam