Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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


Comment on Re: trim leading & trailing whitespace
Download Code
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-09-03 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls