On Jan 3, McCollum, Frank said:

>There is probably a better way to get rid of the whitespace, but the only
>one that comes to mind is:
>
>s/^s+|s+$//; #replace any leading or ("|") trailing whitespace.

First, that needs to be s/^\s+|\s+$//g.  You forgot the \'s as well as the
/g modifier.  Second, that regex is 3.5 times faster written as two
separate regexes:

  s/^\s+//;
  s/\s+$//;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to