Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^5: trim leading & trailing whitespace

by bart (Canon)
on Mar 30, 2005 at 11:10 UTC ( #443408=note: print w/ replies, xml ) Need Help??

in reply to Re^4: trim leading & trailing whitespace
in thread trim leading & trailing whitespace

Danger, don't use \b if you want to detect the edges between spaces an nonspaces. It won't work for nonspace+nonword characters, like quotes and punctuation.

Perhaps replace the \b(.*?) with (\S.*?).

Still, you're not running this with warnings enabled, are you? Both $1 and $2 are optional, so both can be undef, but you use their value regardless. This runs without warnings:


Comment on Re^5: trim leading & trailing whitespace
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2016-02-09 12:06 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (312 votes), past polls