// Whitespace strings: Is Numeric(' ') == true; Is Numeric('\t\t') == true; Is Numeric('\n\r') == true; // Number literals: Is Numeric(-1) == false; Is Numeric(0) == false; Is Numeric(1.1) == false; Is Numeric(8e5) == false; Arrrgh! Reg Ex is icky for this, and I'm not talking just performance.
It's so easy to make subtle, impossible to spot mistakes with your regular expression.
You included '^' to signify the beginning of line, but (as Andy said) you should include '$' to signify the end of line.
If you start your regex with '^' and end it with '$', then it will only match lines that only match your regex.
because your regular expression does match the input.
It's just that the input also includes the extra characters.
1223, -4567, 1223, 4567) we use the regular expression (/^[- ]? Next, the match() method of the string object is used to match the said regular expression against the input value.
If you can't use expression forces Java Script to do type coercion on your input value; it must first be interpreted as a number for the subtraction operation.
If that conversion to a number fails, the expression will result in result is then compared to the original value you passed in.
Unfortunately, intl-tel-input doesn't provide an event or callback that is executed after choosing a country.
Sometimes situations arise (input a phone number, zip code or credit card number) when the user should fill a single or more than one fields with numbers (0-9) in an HTML form.