Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: trim leading & trailing whitespace

by thinker (Parson)
on Mar 30, 2005 at 08:22 UTC ( #443370=note: print w/replies, xml ) Need Help??


in reply to trim leading & trailing whitespace

If you want to trim the leading and trailing whitespace from every line in a multiline string, you can use

s/^\s*(.*?)\s*$/$1/gm

cheers

thinker

Replies are listed 'Best First'.
Re^2: trim leading & trailing whitespace
by ady (Deacon) on Mar 30, 2005 at 08:47 UTC
    yup, i may need that, Good to have on the shelf! Thanks, Allan

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://443370]
help
Chatterbox?
[Discipulus]: sometimes the client dies for extra content </chatter><span class="error" style="color: #cc0000">Server Error (Error ID 9162
[Discipulus]: the span is considered extra content by the parser
[Corion]: Mhmm - that would be some internal error, but I can't look into that right now as I don't have access to the logs from here ;)
[Discipulus]: ah, but it can be skipped by the client (?)
[Corion]: I think so, but I wonder what error might be there...
[Discipulus]: raining in germany? ;=)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2017-07-25 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (366 votes). Check out past polls.