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
~
("?example\.com)/(reviews|used-cars)/([^"\s]*[^/"\s])/?("[\s>])?
~
gm
Input 1
1
New
<a href="example.com/reviews/audi/a6/" class="button">Link with other attr</a> <a href="example.com/reviews/audi/a6/">Link without other attr</a> example.com/reviews/audi/a6
Substitution
$1/$3/$2/$4
<a href="example.com/reviews/audi/a6/" class="button">Link with other attr</a> <a href="example.com/reviews/audi/a6/">Link without other attr</a> example.com/reviews/audi/a6