in reply to Problem with s///

Nik, check out perldoc perlre which will tell you all about the character classes including \d. To answer your question:

$xronos =~ s/:\d{2} \d{4}//g;

Of course, substitution isn't always the answer, you could simply do:

substr($xronos,-8) = "";

and get the same results.

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
Re: Re: Problem with s///
by Nik (Initiate) on Jan 09, 2004 at 13:03 UTC
    Thank you very much! indeed s/// is not always the answer! :)
      Ah, but the substr() solution will fail 7996 years from now. Code for posterity! s/:\d{2} \d{4,}\z//