i
Hate
Regex
Library
Cheatsheet
Community
Open playground
match a url slug
Regex title
Edit anything to remix
Remix in playground
JavaScript
Expression
/
Regular expression
^
[a-z0-9]
+
(?:
-
[a-z0-9]
+
)
*
$
^[a-z0-9]+(?:-[a-z0-9]+)*$
/
gm
g
i
m
s
u
y
flags
Test bench
Sample text
4 matches
best-way
best-d4y
my-1ife
@t-the-sky at-the--sky -
a
fly-
best-way best-d4y my-1ife @t-the-sky at-the--sky - a fly-
Structure
Railroad diagram
Interactive
SVG
PNG
Copy
Embed
Live
Strings that match
best-way
best-d4y
my-1ife
a
Strings that don’t match
@t-the-sky
at-the--sky
-
fly-
Related patterns
url
match a valid url
username
match a username