You can do what you want in one step with a POSIX class. This is what I use:
<cfset form.Price=reReplaceNoCase(form.Price,"[[:punct:]]","","all")> However, this will not protect you completely. I also replace the letter O with a zero (this was actually a common problem. how can people be so stupid?) and then run an isnumeric() test on the value. If after scrubbing it passes isnumeric(), its good. HtH, --Matt Robertson-- Janitor, MSB Web Systems http://mysecretbase.com S. Isaac Dealey wrote: >>Trying to turn $123,456 into 123456 >> >> > > > >>Getting rid of the "$" sign is easy... >> >> > > > >>#Replace(mynumber, "$", "", "ALL")# >> >> > > > >>But I'm not sure how to kill the "$" and the "," at the >>same time with >>the least amount of fuss... >> >> > >I'm going to go out on a limb and recommend you not use a regular >expression for this. Why? Because not everyone formats numbers the >same way, hence I'd recommend uing a combination of LSParseCurrency() >and LSParseNumber() (unless you want to dig into java or use the onTap >framework which already has :) ... > >So by implementing genuine number parsing, you'd be able to reuse that >code later if you discover you need it for an application that will >provide content to german users where the number 1,000.00 is formatted >1.000,00. Obviously if you use the regular expression on these german >formatted numbers, you'll get bad results, since what you want is >1000, but you'll get 1 instead. > >Unfortunately because LSParseCurrency() and LSParseNumber() raise >exceptions instead of returning an empty string when the number can't >be converted (the same way Java does), there's no easy/elegant way to >handle parsing locale-specific numbers and you have to instead rely on >try-catch for each number you need to convert. > >I would put something like this in a CFC you can reuse throughout your >application (or maybe one you're already using): > ><cffunction name="parseCurrency"> > <cfargument name="currency" type="string" required="true"> > > <cfif not len(trim(currency))><cfreturn ""></cfif> > > <cftry> > <cfset currency = LSParseCurrency(currency)> > <cfcatch> > <cftry> > <cfset currency = LSParseNumber(currency)> > <cfcatch><cfset currency = ""></cfcatch> > </cftry> > </cfcatch> > </cftry> > > <cfreturn currency> ></cffunction> > >hth > >s. isaac dealey 434.293.6201 >new epoch : isn't it time for a change? > >add features without fixtures with >the onTap open source framework > >http://www.fusiontap.com >http://coldfusion.sys-con.com/author/4806Dealey.htm > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235741 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

