Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(?:\d{3}-| # area code without parentheses but with dash \(\d{3}\)\ ) # -or- area code with parentheses and no dash \d{3} # first 3 digits - # second dash \d{4} # last 4 digits
"
gx
Input 1
New
(415) 123-2342 and 415-905-1234 are the numbers.