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
%
^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\x{00a1}-\x{ffff}][a-z0-9\x{00a1}-\x{ffff}_-]{0,62})?[a-z0-9\x{00a1}-\x{ffff}]\.)+(?:[a-z\x{00a1}-\x{ffff}]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$
%
iu
Unit Tests
http://foo.com/blah_blah
→ regex does match
http://foo.com/blah_blah/
→ regex does match
http://foo.com/blah_blah/
→ regex does match
http://foo.com/blah_blah_(wikipedia)_(ag…
→ regex does match
http://www.example.com/wpstyle/?p=364
→ regex does match
http://www.example.com/wpstyle/?p=364
→ regex does match
http://www.example.com/wpstyle/?p=364
→ regex does match
http://userid:password@example.com:8080
→ regex does match
http://userid:password@example.com:8080/
→ regex does match
http://userid@example.com
→ regex does match
http://userid@example.com/
→ regex does match
http://userid@example.com:8080
→ regex does match
http://userid@example.com:8080/
→ regex does match
http://userid:password@example.com
→ regex does match
http://userid:password@example.com/
→ regex does match
http://142.42.1.1/
→ regex does match
http://142.42.1.1:8080/
→ regex does match
http://➡.ws/䨹
→ regex does match
http://⌘.ws
→ regex does match
http://⌘.ws/
→ regex does match
http://foo.com/blah_(wikipedia)#cite-1
→ regex does match
http://foo.com/blah_(wikipedia)_blah#cit…
→ regex does match
http://foo.com/unicode_(✪)_in_parens
→ regex does match
http://foo.com/(something)?after=parens
→ regex does match
http://☺.damowmow.com/
→ regex does match
http://code.google.com/events/#&product=…
→ regex does match
http://j.mp
→ regex does match
ftp://foo.bar/baz
→ regex does match
http://foo.bar/?q=Test%20URL-encoded%20s…
→ regex does match
http://مثال.إختبار
→ regex does match
http://例子.测试
→ regex does match
http://उदाहरण.परीक्षा
→ regex does match
http://-.~_!$&'()*+,;=:%40:80%2f::::::@e…
→ regex does match
http://1337.net
→ regex does match
http://a.b-c.de
→ regex does match
http://223.255.255.254
→ regex does match
http://
→ regex does not match
http://.
→ regex does not match
http://..
→ regex does not match
http://../
→ regex does not match
http://?
→ regex does not match
http://??
→ regex does not match
http://??/
→ regex does not match
http://#
→ regex does not match
http://##
→ regex does not match
http://##/
→ regex does not match
http://foo.bar?q=Spaces
should
be
encode…
→ regex does not match
//
→ regex does not match
//a
→ regex does not match
///a
→ regex does not match
///
→ regex does not match
http:///a
→ regex does not match
foo.com
→ regex does not match
rdar://1234
→ regex does not match
h://test
→ regex does not match
http://
shouldfail.com
→ regex does not match
://
should
fail
→ regex does not match
http://foo.bar/foo(bar)baz
quux
→ regex does not match
ftps://foo.bar/
→ regex does not match
http://-error-.invalid/
→ regex does not match
http://a.b--c.de/
→ regex does not match
http://-a.b.co
→ regex does not match
http://a.b-.co
→ regex does not match
http://0.0.0.0
→ regex does not match
http://10.1.1.0
→ regex does not match
http://10.1.1.255
→ regex does not match
http://224.1.1.1
→ regex does not match
http://1.1.1.1.1
→ regex does not match
http://123.123.123
→ regex does not match
http://3628126748
→ regex does not match
http://.www.foo.bar/
→ regex does not match
http://www.foo.bar./
→ regex does not match
http://.www.foo.bar./
→ regex does not match
http://10.1.1.1
→ regex does not match