In the general case, to execute some code (e.g. count) every time a pattern is found, you could use a while loop with m//g:
$_ ='abacdbccdeeabacdbccdee'; my $cnt; while (/[bc]/g) { last if ++$cnt == 3; } say pos;
In reply to Re: a regular expression problem
by Eliya
in thread a regular expression problem
by siskos1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |