Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
\d{3}([ .-])?\d{3}([ .-])?\d{4}|\(\d{3}\)([ ])?\d{3}([.-])?\d{4}|\(\d{3}\)([ ])?\d{3}([ ])?\d{4}|\(\d{3}\)([.-])?\d{3}([.-])?\d{4}|\d{3}([ ])?\d{3}([ .-])?\d{4}
/
gm

Description

phone matcher for following formats (123).234.4567 (123)-234-4567 (617) 495-1797 (617) 495 1797 (617) 4951797

6174951797 617 4951797 123.234.4567 123-456-4567 123.123-1234 123.123-1234 123 123-1234 123 123 1234

Submitted by anonymous - 10 years ago