Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: trim leading & trailing whitespace

by thinker (Parson)
on Mar 30, 2005 at 08:22 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://443370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-09-17 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (22 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.