i
Hate
Regex
Library
Cheatsheet
Community
Open playground
match a social security number
Regex title
Edit anything to remix
Remix in playground
JavaScript
Expression
/
Regular expression
^
(?!
0
{3}
)
(?!
6
{3}
)
[0-8]
\d
{2}
-
(?!
0
{2}
)
\d
{2}
-
(?!
0
{4}
)
\d
{4}
$
^(?!0{3})(?!6{3})[0-8]\d{2}-(?!0{2})\d{2}-(?!0{4})\d{4}$
/
gm
g
i
m
s
u
y
flags
Test bench
Sample text
2 matches
123-45-6789
123 45 6789
333-22-4444
aaa-bbb-cccc 900-58-4564 999-58-4564 000-45-5454
123-45-6789 123 45 6789 333-22-4444 aaa-bbb-cccc 900-58-4564 999-58-4564 000-45-5454
Structure
Railroad diagram
Interactive
SVG
PNG
Copy
Embed
Live
Strings that match
123-45-6789
333-22-4444
Strings that don’t match
123 45 6789
aaa-bbb-cccc
900-58-4564
999-58-4564
000-45-5454
Related patterns
phone number
match a phone number
uuid
match a hyphen-delimited uuid
e.164 phone number
matches a valid e.164 format telephobne number