Regular Expressions 101

Community Patterns

Phone Number (msisdn) filter

1

Regular Expression
PCRE (PHP <7.3)

/
^(?=^(?:tel\:)?(?:[+\ ()]*[0-9]){3,20}\ *$)(?:tel\:)?\ *\+?[0-9\ ]+(?:\([0-9]{1,3}\)[0-9\ ]+)?$
/

Description

MSISDN filter. Should match worldwide phone numbers. It doesn't work for numbers with dashes, so just replace them with empty strings, or edit as you wish.

Submitted by maricn - 9 years ago