Regular Expressions 101

Community Patterns

CS124_HW1:spamlord_phone

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