Try this: if (/^-?\d+\.\d*$/)Incidentally, you could combine the two tests into one regexp, but it looks like you want to keep the distinction between those with decimal points and those without. If not, you could do this: if (/^-?\d+(\.\d*)?$/) Note that this second one will capture the fractional part, if any. If that's undesirable, do: if (/^-?\d+(?:\.\d*)?$/) HTH
In reply to Re: Validating specific numeric input
by VSarkiss
in thread Validating specific numeric input
by jlongino
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |