Monday, November 18, 2013

How to insert a text every x rows in Notepad++?

Google search brought me to How to insert a line break every 5 rows in Excel/Word/Notepad++?

Using the suggested regex from the above source, replace the number 5 with x and replace \n with any text.

For example, to insert a commit; after every 100 lines in a sql script. This would be the regex -

Find       : ((.*\s*\n\s*){100})
Replace : $1commit;\n


7 comments:

Ricardo Cardona R said...

Thanks very helpful

George Mathai said...

It is replacing content in v7.4.2. Can you suggest a solution?

João Noivo Azevedo said...

Change the $1 to $0

Ignacio Moreno said...

funciona muy bien. gracias fenomeno

Jyothi said...

Thanks. It helped a lot.

Jagger said...

It does not work for the last block. It replaces some text there.

ericllynn said...

I have been looking for this solution for so long.. THANK YOU!!!!