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
/
(?!^(\d{1,3}\.){3}\d{1,3}$)(^[a-z0-9]([a-z0-9-]*(\.[a-z0-9])?)*$)
/
g
Unit Tests
a.b.c
→ regex does match
test.bucket
→ regex does match
test
→ regex does match
123
→ regex does match
abcdefghijklmnopqrstuvwxyz0123456789abcd…
→ regex does match
random-test
→ regex does match
test.random-test
→ regex does match
.test
→ regex does not match
-test
→ regex does not match
192.0.0
192.0.0.1
12
→ regex does not match
abcdefghijklmnopqrstuvwxyz0123456789abcd…
→ regex does not match