Regular Expressions 101

Community Patterns

Isralie Phone Number Validator

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:(?:(\+?972|\(\+?972\)|\+?\(972\))(?:\s|\.|-)?([1-9]\d?))|(0\d{1,2}))(?:\s|\.|-)?([^0\D]{1}\d{2}(?:\s|\.|-)?\d{4})$
/
gm

Description

Validates Israeli phone numbers. Accounts for the presence/absence of the 972 country code (with or without the plus sign or parentheses), and the proper formatting of area codes based on the presence/absence of the country code. Allows subdivision using spaces, dashes, periods, or no subdivision.

Submitted by Michael C. - 8 years ago