@damien-moate ,
Thanks for the before/after example; it helps us help you.
The search engine (Find/Replace dialog) does not know how to count, so it cannot be done solely with find/replace.
However, there are a couple of ways of doing it inside Notepad++, if you’re willing to use a plugin, or a multi-step process.
If you like programming/scripting, you can use the PythonScript or similar plugins; there are examples of similar activities if you search the forum for add_1
However, if you really have the <!-- --> comment lines every third line, as shown in your example, I would do the following:
FIND = \R(?!\h*<!--), REPLACE = ☺, SEARCH MODE = Regular Expression
This will condense each group of 3 lines into one long line.
I picked ☺ because that’s not likely in your document already, and it will make the final step really easy
If the first line is really indented differently than the others, as you’ve shown, then you will want to indent the first line to match.
Use Alt+drag next to the --> on each line to “column select”:
5cce2e32-7c36-4667-8ee4-f3fbb7924dd8-image.png
Edit > Column Editor, click
⦿ Number to Insert,
Initial Number = 1,
Increase By = 1,
OK
6f5896ec-a00e-4d1b-9896-2490e866ddce-image.png
3030c347-959c-4467-9a0b-608d8759d9ee-image.png
FIND = ☺, REPLACE = \r\n, SEARCH MODE = Regular Expression
1859ed77-ecff-472b-a6b3-cd98d2251171-image.png