Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Removing multiple newlines from a line using regex

by jwkrahn (Abbot)
on Jul 19, 2011 at 01:55 UTC ( [id://915313]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while ($foo =~ s/(\([^)]*)\n(.*?\))/\1\2/gs) {}
    
  2. or download this
    1 while $foo =~ s/(\([^)]*)\n(.*?\))/$1$2/gs;
    
  3. or download this
    $foo =~ s{ \( ( [^()]* ) \) }{ ( my $x = $1 ) =~ tr/\n//d; $x }gex;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found