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
/
\b(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?:\w+:\w+@)?((?:(?:[-\w\d{1-3}]+\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|edu|co\.uk|ac\.uk|it|fr|tv|museum|asia|local|travel|[a-z]{2}))|((\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)(\.(\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)){3}))(?::[\d]{1,5})?(?:(?:(?:\/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|\/)+|\?|#)?(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?:#(?:[-\w~!$ |\/.,*:;=]|%[a-f\d]{2})*)?\b
/
ig
Input 1
New
# valid http://www.google.com ftp://example.com google.com a.google.com a.google.com/b/~user http://www.google.com/~user www.google.com/sdfa/asdf?f93+3234 accounts.google.com valid.domain.com/foasdf/~23423lj accounts.google.com/login?res=sdfs sdf accounts.google.com you.name you.name/~joe google.com/+joe https://joe:test@test.com # partial http://joe@test.com # invalid not: ftp://example something.asfdasjdlf; abc.def@#$90fai something.like.this abc.def
Substitution
# valid http://www.google.com ftp://example.com google.com a.google.com a.google.com/b/~user http://www.google.com/~user www.google.com/sdfa/asdf?f93+3234 accounts.google.com valid.domain.com/foasdf/~23423lj accounts.google.com/login?res=sdfs sdf accounts.google.com you.name you.name/~joe google.com/+joe https://joe:test@test.com # partial http://joe@test.com # invalid not: ftp://example something.asfdasjdlf; abc.def@#$90fai something.like.this abc.def