Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061064]
help
Chatterbox?
[chacham]: first intel that is. my brother had a an apple ][e some time before that

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2017-03-22 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (276 votes). Check out past polls.