Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
\(*(\d{3})(?:(?:-*|\s*|\.*|\)*|\)\s*))(\d{3})(?:(?:-*|\s*|\.*|\)*))(\d{4})
"
g

Description

Spamlord assignment: this regex detects phone numbers in text.

Submitted by anonymous - 8 years ago