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

isMobilePhone: el-GR incomplete and partially wrong validation #2111

Closed
pano9000 opened this issue Dec 5, 2022 · 0 comments · Fixed by #2112
Closed

isMobilePhone: el-GR incomplete and partially wrong validation #2111

pano9000 opened this issue Dec 5, 2022 · 0 comments · Fixed by #2112
Labels

Comments

@pano9000
Copy link
Contributor

pano9000 commented Dec 5, 2022

Describe the bug
The el-GR locale of isMobilePhone is not validating all valid mobile phone number, but only a certain portion of valid numbers.
And for that one portion, it is also a bit too permissive.

The RegExp currently looks like this and only checks for numbers beginning with 69 (if we ignore the international code):
/^(\+?30|0)?(69\d{8})$/ (from isMobilePhone.js)

However there are quite a few more ranges that qualify as valid mobile phone numbers as per the national numbering plan of Greece |
(archived WaybackMachine Version) that is published on the ITU site, or (a lot more verbose, as it shows all of the different numer blocks: https://eregpublic.eett.gr/searchnum.php?lan=en)

  • 690−1,
  • 693−5,
  • 697−9,
  • 685−9

Aprt from the missing numbers, the current RegExp is currently also matching numbers beginning with 692, which would not be a valid phone number according to references above.

I'll raise a PR later today to get this fixed, this issue is just for reference.

Kind regards,

Pano

pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
update the RegExp to correctly match (and exclude) number ranges as per  official ITU numbering plan:
https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf

fixes validatorjs#2111
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
update the RegExp to correctly match (and exclude) number ranges as per  official ITU numbering plan:
https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf

fixes validatorjs#2111
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
update the RegExp to correctly match (and exclude) number ranges as per  official ITU numbering plan:
https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf

fixes validatorjs#2111
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
update the RegExp to correctly match (and exclude) number ranges as per  official ITU numbering plan:
https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf

fixes validatorjs#2111
pano9000 added a commit to pano9000/validator.js that referenced this issue Dec 5, 2022
profnandaa pushed a commit that referenced this issue Jan 22, 2023
…rectly exclude certain ranges (#2112)

* fix(isMobilePhone): el-GR RegExp fixed

update the RegExp to correctly match (and exclude) number ranges as per  official ITU numbering plan:
https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf

fixes #2111

* tests: update tests for fixed el-GR RegExp

belongs to #2111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant