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
/
^\/root\/[^\/\n]+(?:\/index\.shtml)?$
/
gm
Input 1
/root/index.shtml /root/root_one.shtml /root/one/index.shtml /root/two/index.shtml /root/two/test.shtml /root/two/three/index.shtml /root/2024/index.shtml /root/2024/one.shtml
Substitution
/root/index.shtml /root/root_one.shtml /root/one/index.shtml /root/two/index.shtml /root/two/test.shtml /root/two/three/index.shtml /root/2024/index.shtml /root/2024/one.shtml