-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isMobilePhone accept invalid phone numbers #2055
Comments
@ValeriyaZavozova - the above bug is for ro-RO locale (i.e Romania) and ms-MY locale (i.e Malaysia)? |
Hi @ValeriyaZavozova I am interested in this issue, Can you please assign this to me ? |
@meeraj257 I found only this two cases |
Could anyone verify if - 01468987837 is valid |
@VarnikaB I researched a little on Malaysian telephony on the relevant Wikipedia page. From what I gathered from my research, here's what I can conclude about those numbers.
|
ok |
hi Please assign it to me. I am interested in this |
The maintainers in this repo don't typically assign issues to contributors. Feel free to make a PR, of course! |
FWIW: I can confirm that the numbers return "true" with isMobilePhone: +0711419752 that last one is similarly also reported here: #1066 both are caused by the regexp optionally matching the country code and allowing numbers to also start with 0 For a more future proof solution, there also is a discussion going on here #2124 |
that +0111419752 will be fixed with PR #2155 will now also take a look at those issues caused by the Romanian Regexp |
* fixed the bug that would cause it to match invalid numbers * added tests for invalid numbers fixes validatorjs#2055
+0711419752 those types of numbers will be fixed by #2156 |
* fixed the bug that would cause it to match invalid numbers * added tests for invalid numbers fixes validatorjs#2055
Describe the bug
A clear and concise description of what the bug is.
isMobilePhone
successfully validates invalid numbers (see examples below).I suppose the problem is in the next regular expressions:
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
Examples
If applicable, add screenshots to help explain your problem.
The next numbers will be accepted as valid even though the are not:
+0711419752
+0765351689
+0111419752
Additional context
Validator.js version: 13.7.0
Node.js version: v18.9.1
OS platform: [windows, linux, macOS, etc] macOS
The text was updated successfully, but these errors were encountered: