my $string = '~/tmp/hfj/abc/bhd/5009.xmlreal.xml'; $string =~ s/^.*\/\d+//; print "$string\n";
Another way is to use File::Basename to extract the file name, and then remove the bits you don't want.
use File::Basename; $string = '~/tmp/hfj/abc/bhd/5009.xmlreal.xml'; my ($filename, $directories, $suffix) = fileparse($string); $filename =~ s/^\d+//; print "$filename\n";
Cheers,
Darren
In reply to Re: regular expression
by McDarren
in thread regular expression
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |