use this:
Search: c:(\\)test\\.*\.txt
replace: c:\1test\1afile.txt
The first backslash is stored as tag parameter 1. You then use \1 where ever you need the backslash.
You can also use capital letters after the \;
replace: c:\Test\Afile.txt
will work fine, and at least in Windows, c:\test is the same as c:\Test
Jerry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A simple question. In using search and replace with regular expression I have the following.
search for -> c:\\test\\.*\.txt
replace with -> c:\test\afile.txt
when I do this I get
c:\test\other.txt is replaced by c:<tab>est\other.txt
How do I get the \t to be \t AND not a <tab> character.
use this:
Search: c:(\\)test\\.*\.txt
replace: c:\1test\1afile.txt
The first backslash is stored as tag parameter 1. You then use \1 where ever you need the backslash.
You can also use capital letters after the \;
replace: c:\Test\Afile.txt
will work fine, and at least in Windows, c:\test is the same as c:\Test
Jerry
I believe this is impossible this way.
It seems the regex \t has a preference over the \\ (literal \).
There's one common sense solution and one better way to do what you want.
1. You can replace the c:<tab> by c:\t later, using non-regex mode.
2. You can group anything in regex mode that you want to re-place.
Find field:
(c:\\test\\).*(\.txt)
Replace field:
\1afile\2
This will look for the same matches, but allow you to re-place what you do not want to be changed.
\1_______ : will re-place c:\test\
afile____ : will replace .* by (rename to) afile
\2_______ : will re-place the extension .txt