Basically what you want is to replace any non-empty string of whitespace with either a newline (if the string contains a newline), or with a space. Here's a 5.10 way of doing it:
s/(?:\s*\n\s*(*:N))|(?:\s{2,}(*:S))/{"N","\n","S"," "}->{our $REGMARK} +/ge;
In reply to Re: Replacing \n even when it shouldn't be :/
by JavaFan
in thread Replacing \n even when it shouldn't be :/
by ultranerds
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |