Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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]: which node yesterday?
[Discipulus]: i cannot see any link to tye post..
[Lady_Aleena]: Hello.
[marto]: teleconf + coffee, I'll post it in a few mins
[beech]: fencepost?
beech is protected with velcro

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2017-06-23 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (538 votes). Check out past polls.