Regular Expressions 101

Community Patterns

Actually Good US Phone Regex

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 - 2 years ago