Or just match the bits you care about:<br><br>  $line =~ s/^\s+|\s+$//g;<br><br><div class="gmail_quote">On Tue, May 4, 2010 at 1:35 PM, Steve Fink <span dir="ltr">&lt;<a href="mailto:sphink@gmail.com">sphink@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You might want to also make those +s into *s... (you&#39;re requiring<br>
lines to have whitespace on *both* sides before you&#39;ll fix &#39;em.)<br>
<div><div></div><div class="h5"><br>
On Tue, May 4, 2010 at 1:02 PM, Joe Brenner &lt;<a href="mailto:doom@kzsu.stanford.edu">doom@kzsu.stanford.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; David Alban wrote:<br>
&gt;&gt; it&#39;s so easy to miss the error in:<br>
&gt;&gt;<br>
&gt;&gt;      $line =~ s{ s+ \z }{}xms;<br>
&gt;&gt;<br>
&gt;&gt; when you expect to see:<br>
&gt;&gt;<br>
&gt;&gt;      $line =~ s{ \s+ \z }{}xms;<br>
&gt;&gt;<br>
&gt;&gt; i wondered why one of the lines was having its last character stripped<br>
&gt;&gt; but the others were ok.<br>
&gt;<br>
&gt; The one I like is<br>
&gt;<br>
&gt;   $line =~ s{ ^ \s+ (.*?) \s+ $ }{ $1 }x;<br>
&gt;<br>
&gt; It always takes me awhile to figure out why the leading and<br>
&gt; trailing spaces aren&#39;t all going away.<br>
&gt;<br>
&gt; (I need a \X modifier that makes spaces insignificant in the<br>
&gt; replace string as well as in the find pattern.)<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; SanFrancisco-pm mailing list<br>
&gt; <a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
&gt; <a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
&gt;<br>
_______________________________________________<br>
SanFrancisco-pm mailing list<br>
<a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
</div></div></blockquote></div><br>