What have you tried so far?
A simple solution might to be match all occurrences and then select which you want to keep :
use strict; use warnings; my $string = '1potato 2potato 3potato 4 potato'; print +( $string =~ m/(\d+potato)/g )[2];
In reply to Re: match the nth pattern
by BioLion
in thread match the nth pattern
by abubacker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |