in reply to How do I use regex to strip out specific characters in a string?
$stamp = 'Wed 08/22/2001 2:38p'; my ($month,$day,$year,$time) = ($stamp =~ m|(\d+)/(\d+)/(\d+)\s+([\d:] ++[pa])|); $time =~ s/://; my $newstamp = join('_',$month,$day,$year,$time); print "$stamp => $newstamp\n";
Output:
Wed 08/22/2001 2:38p => 08_22_2001_238p
-Blake
|
|---|