Daniel Kessler wrote: > I'm trying to ensure that all characters entered into a field are > numbers AND/OR a decimal. Valid entries are similar to: 521, > 521.44, .44, 521.4 Invalid entries would be: $521, 52o > I'm working from code that works in another library and I have it > removing all numbers, but it won't allow a decimal. I'd like to > understand what the code is doing and how to also allow a decimal. > Here's the code that I have so far: > > 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. > > Oh, and please cc me with any replies as I get these postings digest. > > thank you. > Try: regEx = /[^0-9\.]/g; (untested) HTH, Phil 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:. -- Need to contact me offlist? Drop -webdev or you probably won't get through.