because your regular expression does match the input.It's just that the input also includes the extra characters.
If that conversion to a number fails, the expression will result in result is then compared to the original value you passed in.
Therefore, despite the fact that it doesn't cover all possible formats of phone number in the world, you can use the regexp validator to test a phone number in your country.
However, there's a special rule that says , and so a value that can't be converted to a number (and only values that cannot be converted to numbers) will result in false.
The check on the length is for a special case involving empty strings.