Regular Expressions 101

Community Patterns

PhoneNumbers with special characters

0

Regular Expression
Python

r"
^\s*(?P<IgnoreBracket>\(?)(?P<area_code>\d{3}?|\d{3})(?P<IgnoreBracket2>\s|\)?)(?P<IgnoreSpecChar>\s*?|-?)(?P<first_three>\d{3})(?P<IgnoreSpecChar1>-?)(?P<last_four>\d{4})\s*?
"
mg

Description

This will help with phone numbers where you want the numbers but not necessarily all the special characters

Submitted by anonymous - 2 years ago