Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Skip 2 new lines

by GrandFather (Saint)
on Nov 08, 2010 at 04:31 UTC ( [id://870017]=note: print w/replies, xml ) Need Help??


in reply to Skip 2 new lines

Maybe you should show us a little sample because what you have shown is not consistent with the problem you describe (or at least not my understanding of it). As given the regex doesn't alter new line characters except in the unlikely context where \s+ is in your expression. That seems an unusual place to be worried about preserving paragraph breaks.

However, if indeed you want to preserve paragraphs where the \s+ is, the following may turn the trick for you:

s/"(?:(?<!\s)(?!\n\n)\s)+", " "//g;
True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://870017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found