Skip to content

IsMobilePhone.js - Update Regular Expression for Validating Israeli (he-IL) mobile number [Urgent as issue in production] #2503

Open
@b2rpt

Description

@b2rpt

Describe the bug
The current regular expression used for validating Israeli phone numbers is flawed and needs updating to accurately match the expected formats (issue with number (+972768818873). The existing regex is as follows:
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,

Examples
Existing Regex unable to validate all phone number for example +972768818873

Reproductions
const validator = require('validator');

// Correct usage with locale
console.log(validator.isMobilePhone('+972768818873', 'he-IL')); // Should return true but returns false

Additional context
Validator.js version: 1.12.0
Node.js version: 20.0.0
OS platform: [windows, linux, macOS]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions