[thelist] javascript numbers with decimals

Daniel Kessler danielk at umd.edu
Tue May 6 09:05:47 CDT 2008

On May 6, 2008, at 9:50 AM, Phil Turmel wrote:
> Daniel Kessler wrote:
>> regEx = /\D/g; // String to remove any characters that are not  
>> numbers	
>> filteredField=field.value.replace(regEx,"") // text field numeric   
>> characters only
>> Clearly I need to update the first line to include the decimal,  
>> but  haven't yet figured out how.  I'll keep on it.
> Try:
> regEx = /[^0-9\.]/g;

That worked great.  I don't quite understand what I'm doing though.   
These chars aren't a string?  so they don't have to be quoted?

> ps.  This list is a "mangled" list, which means reply-to-all  
> doesn't work.  I had to add your CC: manually.  You might want to  
> consider switching to non-digest mode while actively soliciting  
> help, as some respondents won't notice the missing CC:.

I'll keep that in mind, thank you.  This query of trying to  
understand it isn't as urgent as I was in getting it to work.

I very much appreciate the help too.


Daniel Kessler

University of Maryland College Park
School of Public Health
3302E HHP Building
College Park, MD  20742-2611
Phone: 301-405-2545

More information about the thelist mailing list