Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
^\s*(?:\+?(\d{1,3})\s*)?(\s?\(?\d{2}\)\s?)?(\s?[-. (]*(\d{3})[-. )]*)?((\d{3,4})[-. ]*(\d{2,5})(?:[-.x ]*(\d+))?)\s*$
"
gm

Description

REGEX to test various phone numbers

Submitted by Drew Recker - 3 years ago