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
~
^[^\\\r\n]*\\([^\\\r\n]+(?:\\[^\\\r\n]+)+)\\[^\\\r\n]+$
~
gm
Input 1
1
New
c:\foo\bar\baz.txt C:\FOO\BAR\BAZ.TXT C:\FoO\BaR\BaZ.TxT C:\FoO\BaR\test\BaZ.TxT and so on. Expression should match "foo\bar". C:\FOO\\\BAR\BAZ.TXT C:\FOO\\BAZ.TXT
Substitution
c:\foo\bar\baz.txt C:\FOO\BAR\BAZ.TXT C:\FoO\BaR\BaZ.TxT C:\FoO\BaR\test\BaZ.TxT and so on. Expression should match "foo\bar". C:\FOO\\\BAR\BAZ.TXT C:\FOO\\BAZ.TXT