use strict; use warnings; my $str = '6AG3_608_FGG_20100124_20120923418_20126254447_201262512026. +txt'; $str =~ m/(.*)(_\d{11,}?.*)(\.\w+)/; print $1, "\n"; print $2, "\n"; print $3, "\n";
prints
6AG3_608_FGG_20100124_20120923418_20126254447
_201262512026
.txt
But i want it to print
6AG3_608_FGG_20100124
_20120923418_20126254447_201262512026
.txt
Basically the filename gets appened with "_timestamp" after the YYYMMDD part everytime when it gets processed. i want to strip out the time stamps alone.
What i am doing wrong here?
Any help is much appreciated and thanks.
In reply to why my reg ex matches greedy? by lngperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |