I try to add a given number of line breaks in Notepad++. But searching for \r\n
and replacing with [\r\n]{10}
doesn't work for me. Regular expressions interpretation is on.
How should i add a number of line breaks?
Asked
Active
Viewed 194 times
2

Evgeniy
- 2,337
- 2
- 28
- 68
-
Use `Extended`mode and replace `\r\n` with `\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n` – Wiktor Stribiżew Jul 25 '16 at 15:52
1 Answers
2
Note that a replacement pattern is not accepting a regular expression. A regex can be used inside Find what field, but not in Replace with.
Use Extended
mode and replace \r\n
with \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
to replace 1 linebreak with 10.
A regex to match any line break is \R
(be it \r\n
, or \n
or \r
), by the way.
To make it more "dynamic", you may use a PythonScript like
editor.rereplace(r'\r\n', '\r\n'*10)

Wiktor Stribiżew
- 607,720
- 39
- 448
- 563
-
and if it should be 100 or 1000? i'm looking for regex with specification of the number – Evgeniy Jul 25 '16 at 15:56
-
1It is impossible with regex replacement in SR window. You may write a Python script to accomplish that though. See my update. [See how to use PythonScript in Notepad++](http://stackoverflow.com/questions/37300462/notepad-find-replace-number-with-increment-value/37300757#37300757). – Wiktor Stribiżew Jul 25 '16 at 15:56