Join us today!
Multi-line find replace command in Notepad++
When you need to find and replace multiple lines in Notepad++, you must select Extended as search mode on the replace menu.
For example, to replace the lines below :
//replaces these lines with new lines
new line 1
new line 2
//new lines
new line 1
new line 2
Find what: my test line 1\r\nmy test line 2
Replace with: new line 1\r\nnew line 2
This method comes in very handy when you need to modify multiple lines in an xml file with thousands of lines in it.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
In Notepad++ and other good editors like SublimeText or JetBrains (pycharm clion intelliJ) i recommend using regular expressions.
Not only you can change everything you need, but search might be used as a variable (match group). So you can do everything, like swap columns in CSV, change standard of some numbers (serials with "-" between groups etc.)
This is page about regular expressions.
Regular Expression Reference: Capturing Groups and Backreferences (regular-expressions.info)
Discovering Regex in text editing is like discovering quantum physics - small interesting effect which evolved to brand new world 😉
Example:
If you have
4-5-6 and want to achieve 654 (rearranging and concatenate digits) just type:
search : (\d)-(\d)-(\d)
replace with: \3\2\1
I was shocked when I learned using regex. it should be taught in primary school.
If you have a problem with Regex, I will be happy to help.
@mirek-boniewicz +1 on learning regex. After I learned it, I discovered so many usages for it. I never imagined that I could use this skill so often :D.
My blog: https://cookncode.com/twincat
My code: https://github.com/roald87
- 17 Forums
- 267 Topics
- 924 Posts
- 1 Online
- 737 Members