Berkeley CSUA MOTD:Entry 48415
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2007/10/22-25 [Computer/SW/Languages/Perl] UID:48415 Activity:nil
10/22   I want a perl regex that reduces 2 or more consecutive newlines to
        2 newlines.  perl -pe 's/\n\n(\n*)/\n\n/gms' doesn't work, and I
        don't understand why.  Any ideas?
        \_ You're reading your input one line at a time.  Try this:
           perl -0pe 's/\n\n+/\n\n/g'  --mconst
        \_ Are they just \n's or are they \n\r's?