Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
(?:[\r\t\f\v ]*)(\(?[0-9]{3}\)?[-.● ]?[0-9]{3}[-.● ]?[0-9]{4})(?:\s*)
"
mg

Description

Pulls US phone numbers from anywhere in a string of text regardless of separator or beginning parenthesis

Submitted by anonymous - 3 years ago