The length-based approaches are probably a bit faster, but this also seems to work:
>perl -wMstrict -le "my $s = qq{\t\t\tX\t\t}; my $n =()= $s =~ m{ \G \t }xmsg; print $n; " 3
Update: Removed pointless capture group from regex.
In reply to Re: Simple regex related problem
by AnomalousMonk
in thread Simple regex related problem
by rachitmohta11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |