Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(\+)(?(1))\d{1,3}?[- ]?\d{10}$|^([^0])(?(1))\d{9}?$|^([0])(?(1))\d{10}?$
/

Description

This is not supported in Javascript! Works well for php, python. Examples: +91-8800119719, 08800119719, 8800119719, +918800119719 etc.

Submitted by Prateek Jain - 10 years ago