Re: Regex to strip out non-numerics but leave decimal point
Ok ... good. Thanks Nathan! On Tue, Jan 18, 2011 at 10:02 PM, Nathan Strutz wrote: > > [:digit:] seems like a lot of typing to just say \d, and why the extra > character brackets around the outside? > > I would do this: > > reReplace(str, "[^\d\.]", "", "all") > > less typing = improvement > > nathan strutz > [http://www.dopefly.com/] [http://hi.im/nathanstrutz] > > > On Tue, Jan 18, 2011 at 1:04 PM, Jason Fisher wrote: > > > > > reReplace(rc.hourlyRateInvoicedToClient, "[^[:digit:]\.]", "", "all") > > > > > > A set [] takes all the options in it as options, so escape the . with \. > > and you should be good to go. > > > > > > > > From: "Nando" > > Sent: Tuesday, January 18, 2011 2:09 PM > > To: "cf-talk" > > Subject: Regex to strip out non-numerics but leave decimal point > > > > I'm trying to strip out all non-numeric characters from some fields. The > > catch is I need the regex to leave in the decimal point, cuz these are > > rates > > that include cents. > > > > rereplace(rc.hourlyRateInvoicedToClient,'[^[:digit:]]','','all') > > > > I'm not sure how to work something like [^\.] into it. Can anyone help? > > > > Thanks, > > > > Nando > > > > > > > > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341020 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex to strip out non-numerics but leave decimal point
[:digit:] seems like a lot of typing to just say \d, and why the extra character brackets around the outside? I would do this: reReplace(str, "[^\d\.]", "", "all") less typing = improvement nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Tue, Jan 18, 2011 at 1:04 PM, Jason Fisher wrote: > > reReplace(rc.hourlyRateInvoicedToClient, "[^[:digit:]\.]", "", "all") > > > A set [] takes all the options in it as options, so escape the . with \. > and you should be good to go. > > > > From: "Nando" > Sent: Tuesday, January 18, 2011 2:09 PM > To: "cf-talk" > Subject: Regex to strip out non-numerics but leave decimal point > > I'm trying to strip out all non-numeric characters from some fields. The > catch is I need the regex to leave in the decimal point, cuz these are > rates > that include cents. > > rereplace(rc.hourlyRateInvoicedToClient,'[^[:digit:]]','','all') > > I'm not sure how to work something like [^\.] into it. Can anyone help? > > Thanks, > > Nando > > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340987 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex to strip out non-numerics but leave decimal point
Thanks much Jason. On Tue, Jan 18, 2011 at 9:04 PM, Jason Fisher wrote: > > reReplace(rc.hourlyRateInvoicedToClient, "[^[:digit:]\.]", "", "all") > > > A set [] takes all the options in it as options, so escape the . with \. > and you should be good to go. > > > > From: "Nando" > Sent: Tuesday, January 18, 2011 2:09 PM > To: "cf-talk" > Subject: Regex to strip out non-numerics but leave decimal point > > I'm trying to strip out all non-numeric characters from some fields. The > catch is I need the regex to leave in the decimal point, cuz these are > rates > that include cents. > > rereplace(rc.hourlyRateInvoicedToClient,'[^[:digit:]]','','all') > > I'm not sure how to work something like [^\.] into it. Can anyone help? > > Thanks, > > Nando > > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340985 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
re: Regex to strip out non-numerics but leave decimal point
reReplace(rc.hourlyRateInvoicedToClient, "[^[:digit:]\.]", "", "all") A set [] takes all the options in it as options, so escape the . with \. and you should be good to go. From: "Nando" Sent: Tuesday, January 18, 2011 2:09 PM To: "cf-talk" Subject: Regex to strip out non-numerics but leave decimal point I'm trying to strip out all non-numeric characters from some fields. The catch is I need the regex to leave in the decimal point, cuz these are rates that include cents. rereplace(rc.hourlyRateInvoicedToClient,'[^[:digit:]]','','all') I'm not sure how to work something like [^\.] into it. Can anyone help? Thanks, Nando ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340980 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm