Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: regular expression: match multiple newlines

by Kenosis (Priest)
on Nov 03, 2013 at 19:38 UTC ( #1061064=note: print w/ replies, xml ) Need Help??


in reply to regular expression: match multiple newlines

Try:

s/\n{2,}/EEEEE/g

Output on your dataset:

dogs rats catsEEEEEfish

The \n{2,} notation matches 2+ newlines.

Edit: My apologies. Didn't notice the the OP's mentioning the possibility of other whitespace between the newlines.


Comment on Re: regular expression: match multiple newlines
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2015-07-06 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls