in reply to Re^4: trim leading & trailing whitespace
in thread trim leading & trailing whitespace
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:
s/^\s*?((?:\S.*?)?)\s*?(\n?)$/$1$2/gm;
|
---|