I have a regexp which checks if a value has at least 10 digits:
if (foo.match(/^\d{10,}$/))
{
// At least 10 digits
}
However I want to divide the validation in 2 steps, so first i check if foo
has got only numbers, and no other characters, and then i check if its got at least 10 digits.
I can check the 10 digits part using foo.length
, but how do i change the regexp above to check if foo has got only numbers. Any ideas?