in reply to How do I use regex to strip out specific characters in a string?

$stamp =~ s/\w+\s+(\d+)\/(\d+)\/\d+\s(\d+).(.*)/$1_$2_$3$4/;


Update:

Removed my extra \ ;) ups

T I M T O W T D I
  • Comment on Re: How do I use regex to strip out specific characters in a string?
  • Download Code

Replies are listed 'Best First'.
Re: Re: How do I use regex to strip out specific characters in a string?
by blakem (Monsignor) on Aug 23, 2001 at 00:09 UTC
    $stamp =~ s/\w+\s+(\d+)\/(\d+)\/\d+\s(\d+).(.*)\/$1_$2_$3$4/;

    That wont even compile... youve been tripped up by your leaning toothpicks ('/\/\/\/\'). You can avoid that by changing your regex delimiter... i.e.

    s|\w+\s+(\d+)/(\d+)/\d+\s(\d+).(.*)|$1_$2_$3$4|

    -Blake