Re: Regular Expression - decimal number positive negative

2012-12-14 Thread Nathan Strutz
So you need something like [^0-9\.-] This just adds the dash to your existing match. You could get a lot better though, like this -?\d+(\.\d+)? -? matches an optional negative indiator, aka a dash \d+ is just numbers, same as 0-9, the only part of this regex that is required (\.\d+)? means

Re: Regular Expression - decimal number positive negative

2012-12-14 Thread Matt Quackenbush
A contrived, slightly expanded example based upon Nathan's code... cfscript samples = { a = 5.24, b = -5.24, c = 5, d = -5, e = $5.24, f = $5,244.22 }; for ( key in samples ) { writeOutput( reReplace( reReplace(

Re: Regular Expression - decimal number positive negative

2012-12-14 Thread Adam Cameron
Recommend not reinventing the wheel here: http://www.cflib.org/udf/NumberUnFormat On 14 December 2012 14:59, Paul Giesenhagen p...@quilldesign.com wrote: Heya, I know that some will know this quickly ... but I have ReplaceNoCase(str, [^0-9\.],,ALL) And this takes -5 to 5 ... which is

RE: Regular Expression - decimal number positive negative

2012-12-14 Thread Paul Giesenhagen
Good deal ... thank you! -Original Message- From: Adam Cameron [mailto:adamcameroncoldfus...@gmail.com] Sent: Friday, December 14, 2012 9:28 AM To: cf-talk Subject: Re: Regular Expression - decimal number positive negative Recommend not reinventing the wheel here: http