-- Does your code ... ?
Yup.
-- If so, that would do the same thing.
Well it achieves the same result, but I would guess that just REFind is more
efficient than IsNumeric+REReplace.
-- Also, is that, then, what your JS version is doing?
Yup, variable.match(/.../) is the equivalent to REFind("...",variable)
>Hi, Peter...
>
>What my REReplace is doing is saying that
>if, after taking out any periods, dollar signs, or commas,
>the resulting entry is not numeric, then the entry is wrong.
>
>If the entry only has digits, periods, dollars signs, or commas,
>(I guess I'm hoping in the right places), then the entry can be
>parsed with LSParseCurrency before inserting into a database.
>
>Does your code "REFind('[^0-9.$,]', Form.Sale_Price" state that
>if anything besides digits 0-9 and periods, dollar signs, and commas
>are found in the entry it's invalid? If so, that would do the same thing.
>
>Also, is that, then, what your JS version is doing? Checking to make
>sure there's nothing but digits 0-9, periods, dollar signs, and commas
>in the entry?
>
>Thanks for the help...
>
>Rick
>
>-----Original Message-----
>From: Peter Boughton [mailto:[EMAIL PROTECTED]
>Sent: Saturday, March 10, 2007 2:22 PM
>To: CF-Talk
>Subject: Re: How to turn this into a REGEX for use in javascript?
>
>Odd way of doing things?
>
>I'd switch it to something like this:
><cfif NOT REFind('[^0-9.$,]', Form.Sale_Price)>
>....
></cfif>
>
>Which (I think) can be translated into this JS:
>if (sale_price.match(/[^0-9.$,]/) == false)
>{
>....
>}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 &
Flex 2.
Free Trial
http://www.adobe.com/products/coldfusion/flex2/
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272290
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4