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

allow spaces in Hong Kong and Macau phone numbers #1213

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const phones = {
'en-GB': /^(\+?44|0)7\d{9}$/,
'en-GG': /^(\+?44|0)1481\d{6}$/,
'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,
'en-HK': /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,
'en-MO': /^(\+?853\-?)?[268]\d{3}\-?\d{4}$/,
'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
Expand Down
7 changes: 7 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4193,6 +4193,8 @@ describe('Validators', () => {
'+85291234567',
'+852-91234567',
'+852-9123-4567',
'+852 9123 4567',
'9123 4567',
'852-91234567',
],
invalid: [
Expand All @@ -4209,15 +4211,20 @@ describe('Validators', () => {
'+85361234567',
'+853-61234567',
'+853-6123-4567',
'+853 6123 4567',
'6123 4567',
'853-61234567',
],
invalid: [
'999',
'12345678',
'612345678',
'+853-12345678',
'+853-22345678',
'+853-82345678',
'+853-612345678',
'+853-1234-5678',
'+853 1234 5678',
'+853-6123-45678',
],
},
Expand Down