perl regex help matching varying number values -
looking perl regex.
i need extract (3) items filename: abc101.name.aue-abc_p002.20110124.csv
abc101
.name.aue
-abc_p002
.20110124.csv
where item (3) in example 002, can max of 4 digits, 0002
here's non working regex:
while (my $line=<>) { chomp $line; if ($line =~ m/abc(d{3}).name.(w{3})_p([0-9]).[0-9].csv/) { print $1; print $2; print $3; } }
while (my $line=<>) { chomp $line; if ($line =~ /^abc(\d{3})\.name\.(\w{3})-abc_p(\d{1,4})\.\d+.csv$/) { print $1; print $2; print $3; } }
Comments
Post a Comment