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"
(?:^(\w{1,255}):(.{1,255})@|^)(?:(?:(?=\S{0,253}(?:$|:| ))((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z0-9]{1,63})))|localhost)(:\d{1,5})?
"
gmi
Input 1
New
Valid localhost addresses: localhost user:password@localhost:80 localhost:8080/path/to/page.html Valid IPv4 addresses: 10.10.0.1 192.168.0.1 192.168.0.1:8888 user:password@192.168.0.1:8888 user:password@192.168.0.1 Valid IPv6 addresses: // regex does not check for that, check here: http://vernon.mauery.com/content/projects/linux/ipv6_regex 100:: 100::ffff:ffff:ffff:ffff ::ffff:0.0.0.0 64:ff9b::0.0.0.0 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff fe80:: 2001:2f:ffff:ffff:ffff:ffff:ffff:ffff 2001:db8:: ::1 Valid domains: // all should work www.test.com www1.test.com www1.test.com:8080 test.com test-test.com test.com/path/to/page?var=1&var2=2 test.com:80 user:password@test.com user:password@test-test.com user:password@test.com/path/to/page user:password@test.com/path/to/page?var=1&var2=2 user:password@test.com:80 user:password@test.com:80/path/to/page?var=1&var2=2 Maximum-Length-Of-63-Characters-For-A-Subdomain-Completely-Used.com user:password@Maximum-Length-Of-63-Characters-Fo