On Jun 4, David Gilden said:

>Is version 2 a better choice here?

>$name= "bill_gates_the_third_132506042001.html";

>    $name =~ s/^(\w+?)_(\d+).html$/$1/;
>    $name =~ tr/_/ /;

>$name= "bill_gates_the_third_132506042001.html";
> $name =~ s/\d+.html$//;
> $name =~ tr/_/ /;
> $name =~ s/\s$//;

Can't you be pretty sure there won't be any spaces in the URL?  And why
not just do

  $name =~ s/\s*\d+\.html$//;

then, to remove the spaces at the same time.  Or are you afraid of the
newline that might be at the end?

  $name =~ s/\s*\d+\.html\n?\z//;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Eruséro Marillion -- wielder of Ringril, known as Hesinaur, the Winter-Sun
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to