Friday 15 January 2010

notepad++ - Search and replace only first result on each file with notepad ++ -


Is there a way to find any string that is repeated multiple times in each file but only the first result on each file changes is?

Thank you

Find Find files < Click the / strong> tab in the Change to Files button. To replace abc with def in all files, you use the following regular expression search string \ A (. *?) ABC (. *) \ Z with \ 1ghi \ 2 . You will need to select both the Regular Expressions and Dot Match New Line .

\ A matches only the beginning of the file (. *?) ABC is a non-greedy match and capture everything But does not include the first abc (. *) captures all the other until the end of the file and the file which is \ z code>. (I used without (. *) \ Z part and all the events of abc changed.)

If the replacement requirement is also regular Expression You may need to change the \ 2 section of the Copy Text.

It does not know how it will work with large files before recommending backups before using the Replace in files feature.

Notepad ++ 6.3.2 tested with two very small files.

No comments:

Post a Comment