Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
@"
\b(https?://\S+/)[^\s?#/]+(?![^\s?#])
"
gm
Input 1
1
New
For any of the following URLs, I'm looking for a match for segment as follows: https://example.com/what-not/segment matches segment https://example.com/what-not/segment?a=b matches segment https://example.com/what-not/segment#a matches segment In case there is a match for segment, I'm going to replace it with segment/. For any of the following URLs, there should be no match: https://example.com/what-not/segment/ no match https://example.com/what-not/segment/?a=b no match https://example.com/what-not/segment/#a no match
Substitution
$1segment/