Right now, I’m using this to check if a certain value is numeric:
(variable.match(/^[\d]*$/ ))
How could I modify that code so it will accept a “.” or period. I looked at other websites, and I couldn’t seem to find anything that would let it accept a “.” without accepting letters. Answers are appreciated, thanks.
(variable.match(/^[\d]*(\.\d+)?$/ ))this would accept number with or without dot… but if there is a dot – there must be a number after it
this strings are all valid: 01, 12.3, .23, 12, .3 ….
this strings are invalid: 12. (with the dot), 1.1.1
hope I helped…