开发者

Notepad++ How do I find and replace part of a directory/file location string?

开发者 https://www.devze.com 2023-02-06 00:33 出处:网络
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.

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

Replacing with: 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

0

精彩评论

暂无评论...
验证码 换一张
取 消