Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Community Library
How to contribute
x
Extract root domain from URL
Open Workspace
PCRE (Legacy)
Match
Created 2021-10-01 14:25
0
Regular Expression
/
(?:
[^
:
]
+
:
\/\/
)(?:
www
\.
)*(
[
.a
-
z0
-
9
]
+
)+
/
Description
It will extract the root domain from any URL. This includes removing subdomains,
www
. and the slug.
Submitted by
randywolf244