Skip to content

Commit c81df18

Browse files
authored
fix(isMobilePhone): Fix en-BM matching invalid numbers due to missing end-of-string anchor (#2116)
fixes #2115 related to #2115
1 parent f9d49fc commit c81df18

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const phones = {
3636
'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/,
3737
'en-AU': /^(\+?61|0)4\d{8}$/,
3838
'en-AG': /^(?:\+1|1)268(?:464|7(?:1[3-9]|[28]\d|3[0246]|64|7[0-689]))\d{4}$/,
39-
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
39+
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}$))/,
4040
'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/,
4141
'en-GB': /^(\+?44|0)7\d{9}$/,
4242
'en-GG': /^(\+?44|0)1481\d{6}$/,

test/validators.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7131,6 +7131,7 @@ describe('Validators', () => {
71317131
'+4418970973',
71327132
'',
71337133
'+1441897465',
7134+
'+1441897465 additional invalid string part',
71347135
],
71357136
},
71367137
{

0 commit comments

Comments
 (0)