I have the following regex to try to reduce groups of newlines:
s/(\n|\r\n|\n\r)(\n|\r\n|\n\r)(\n|\r\n|\n\r)+/\n\n/gmi;
It started out as:
s/\n\n(\n)+/\n\n/gmi
I am looking to reduce the number of newlines that are continuous to a maximum of two in a row (just trying to do some cleanup on some files that I am importing for an internal wiki). The data has several lines of CRLF's spread throughout it (Windows data files). Yet, it doesn't seem to work.
What am I doing wrong? Here is a sample where it is coming out wrong:
Starts off as:
added missing options for Menu and toolbar positioning</p> </div> </body> </html>
I am stripping HTML tags, so it ends up like this:
added missing options for Menu and toolbar positioning
Then I apply the regex and it comes out as:
added missing options for Menu and toolbar positioning