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}(?:[\-+](?:\d{4}(?:[\-+](?:\d{2})?)?)?)?
"
gm
Input 1
1
New
Examples of strings that match: '123-1234-12' '123-1234-' '123-1234' '123-' '123' Examples of strings that don't match: '1231234-12' '123-123412' '123--12'