in reply to How to take only maximum directory name by using its digits using perl?
In addition to the problem of the extraneous underscore in /rev_(\d)+/ in the OP, note also that (\d)+ will not match what I think you think it will if there is more than one digit present:
Capture multiple digits with:c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'foorev_123bar'; ;; print qq{captured '$1'} if $s =~ m{ rev_ (\d)+ }xms; " captured '3'
One previous reply has implicitly noted this problem. (Update: haukex has also addressed this below.)c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'foorev_123bar'; ;; print qq{captured '$1'} if $s =~ m{ rev_ (\d+) }xms; " captured '123'
Give a man a fish: <%-{-{-{-<
|
|---|