Skip to content

Commit

Permalink
fix(isMobilePhone): update phone regex for Ukraine uk-UA (validatorjs…
Browse files Browse the repository at this point in the history
…#2359)


Co-authored-by: vfarylevych <[email protected]>
  • Loading branch information
arttiger and vfarylevych authored Jun 1, 2024
1 parent 4bca6f0 commit c25b98f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const phones = {
'th-TH': /^(\+66|66|0)\d{9}$/,
'tr-TR': /^(\+?90|0)?5\d{9}$/,
'tk-TM': /^(\+993|993|8)\d{8}$/,
'uk-UA': /^(\+?38|8)?0\d{9}$/,
'uk-UA': /^(\+?38)?0(50|6[36-8]|7[357]|9[1-9])\d{7}$/,
'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/,
Expand Down
59 changes: 55 additions & 4 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9427,16 +9427,67 @@ describe('Validators', () => {
{
locale: 'uk-UA',
valid: [
'+380982345679',
'380982345679',
'80982345679',
'0982345679',
'+380501234567',
'+380631234567',
'+380661234567',
'+380671234567',
'+380681234567',
'+380731234567',
'+380751234567',
'+380771234567',
'+380911234567',
'+380921234567',
'+380931234567',
'+380941234567',
'+380951234567',
'+380961234567',
'+380971234567',
'+380981234567',
'+380991234567',
'380501234567',
'380631234567',
'380661234567',
'380671234567',
'380681234567',
'380731234567',
'380751234567',
'380771234567',
'380911234567',
'380921234567',
'380931234567',
'380941234567',
'380951234567',
'380961234567',
'380971234567',
'380981234567',
'380991234567',
'0501234567',
'0631234567',
'0661234567',
'0671234567',
'0681234567',
'0731234567',
'0751234567',
'0771234567',
'0911234567',
'0921234567',
'0931234567',
'0941234567',
'0951234567',
'0961234567',
'0971234567',
'0981234567',
'0991234567',
],
invalid: [
'+30982345679',
'+380321234567',
'+380441234567',
'982345679',
'80982345679',
'+380 98 234 5679',
'+380-98-234-5679',
'+380 (98) 234-56-79',
'',
'ASDFGJKLmZXJtZtesting123',
'123456',
Expand Down

0 comments on commit c25b98f

Please sign in to comment.