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

Add support for armenia phone #1217

Merged
merged 2 commits into from
Dec 30, 2019

Conversation

dani2819
Copy link
Contributor

@dani2819 dani2819 commented Dec 16, 2019

Resolves: #1215
Resolves the above-mentioned issue but with a different kind of regex (not the one stated in the issue). That regex was very general. To know more about the format of Armenia phone, view this link.

The format is:

  • +374 or 0 followed by 10 (Yerevan city code) plus 6 more digits
  • +374 or 0 followed by any digit starts with 2 - 4 plus 7 more digits.
  • +374 or 0 followed by digits starts with 9 or 7 (Mobile carriers) plus 7 more digits.

Hence, the regex is /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/.

@dani2819 dani2819 force-pushed the armenia-phone-validation branch from ceacafa to c9e9b23 Compare December 16, 2019 11:51
Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your PR! 🎉

@profnandaa profnandaa merged commit ea39867 into validatorjs:master Dec 30, 2019
@githuboftigran
Copy link

@dani2819 , @profnandaa , this regex doesn't work for some phones.
This regex accepts only phones with local code 10 (BTW this is not a mobile but city code for Yerevan) or 70s or 90s (+37410..., +37477..., +37491...)
However there are some other local codes like 41, 55, 88, etc. And this will accept also phones with local codes that don't exist. For example: +37492... or +37472...
Here are all mobile codes at the moment:

Mobile Operator | Code
Beeline | 91, 99, 96, 43, 33
Ucom | 55, 95, 41, 44
VivaCell-MTS | 93, 94, 77, 98, 49, 88

https://en.wikipedia.org/wiki/Telephone_numbers_in_Armenia

@dani2819
Copy link
Contributor Author

@githuboftigran I know that it will accept the codes such as +37492... or +37472... etc. I made the regex bit flexible in this regard and that's not a big problem. But yes it won't accept 55. I will add that later :)

@profnandaa
Copy link
Member

@githuboftigran -- PR welcome 👍

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

Successfully merging this pull request may close these issues.

am-AM Armenia phone support
3 participants