http://www.perlmonks.org?node_id=950675


in reply to Re: How do I remove whitespace at the beginning or end of my string?
in thread How do I remove whitespace at the beginning or end of my string?

MRE_regx does not trim whitespace as expected:
$ perl -de 1 Loading DB routines from perl5db.pl version 1.3 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> $str = ' x '; $str =~ s/^\s+((?:.+\S)?)\s+$/$1/s; DB<2> x $str 0 ' x'