in reply to Re: why my reg ex matches greedy?
in thread why my reg ex matches greedy?

hi McA, thanks. yes that is what eventually i would need. but i would like to understand the reg ex to extract the pattern.

Replies are listed 'Best First'.
Re^3: why my reg ex matches greedy?
by McA (Priest) on Jun 25, 2012 at 21:12 UTC
    Ok ok ok,
    then take this:
    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";