Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Skip 2 new lines

by GrandFather (Saint)
on Nov 08, 2010 at 04:31 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-01-20 06:15 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (56 votes). Check out past polls.