I'm trying to replace the middle of a directory string. I know the first two folders will always be the same but the middle is always different. Also the file names will always be different.
For example:
Finding: c:/Users/owner/someFolder/someOtherFolder/filename.png
c:/Users/owner/newFolder/filename.png
The amount of folders from owner to the file is varies. The file type开发者_C百科 will always be png
and c:/Users/owner/
is constant.
Just use regular expresion replace
for example :
replace this :
c:/Users/owner/someFolder/(.*)/filename.png
or what ever you want to use instead of (.*)
and replace with what ever you want
Make sure you check the option that says replace using regular expression on the find and replace window otherwise this wont work
Use this:
Search what: (?<=c:/Users/owner/).+(?=/[^/]+\.png)
Replace with: newFolder
精彩评论