Skip to content
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

Incorrect regex pattern #2312

Open
amir-khoshbakht opened this issue Oct 4, 2023 · 4 comments
Open

Incorrect regex pattern #2312

amir-khoshbakht opened this issue Oct 4, 2023 · 4 comments

Comments

@amir-khoshbakht
Copy link

https://github.com/validatorjs/validator.js/blob/b958bd7d1026a434ad3bf90064d3dcb8b775f1a9/src/lib/isMobilePhone.js#L95C26-L95C26

I think this part of this pattern is wrong:
image

this regex pattern matches : '90', '91', '92', '93', and '99'. While in reality it can be any number after the number 9.
according to this wikipedia page the actual pattern for mobile number in this region is: 09xx xxx xxxx. so the 094...... is a valid number for this region while this regex code does not include it.

@codevivekk
Copy link

HI I would like to work on this issue

@codevivekk
Copy link

Hi i have raised the pr please check #2316

@pano9000
Copy link
Contributor

pano9000 commented Oct 9, 2023

Hi,

thanks for your comment.
If I check the official ITU numbering plan for Iranian mobile number, the current Regex is too permissive already, and your proposed change would be even more permissive

https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000660028PDFE.pdf

@saikiran76
Copy link

'fa-IR': /^(\+?98|0)?9\d{9}$/,
This updated pattern allows for any digit after '9' and ensures that the phone number starts with '09' and is followed by 9 digits. With this change, the regex pattern will correctly match Iranian mobile phone numbers in the "09xx xxx xxxx" format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants