I am trying to check a field called phone_number with these rules:
the first digit should be 3, and then another 9 digits, so a total of 10 numeric examples: 3216549874
or maybe 7 numbers 1234567
here i have the code:
if (!($("#" + val["htmlId"]).val().match(/^3\d{9}|\d{7}/)))
missing = true;
Why it doesn’t work :( When I put this in the online regex check, it shows well.
source
share