On 27 Aug 2000 19:01:45 -0000, Perl6 RFC Librarian wrote:
>m//g just returns 1 for matching.
Er... but in a scalar context, m//g DOES only match once! If you want
more, repeat the match. Or use it in a list context, then it will try to
match them all.
$_ = "abaabbbababbbabbaaa";
while(/(b+)/g) {
print "Got a '$1'\n";
}
-->
Got a 'b'
Got a 'bbb'
Got a 'b'
Got a 'bbb'
Got a 'bb'
Let's try again:
$_ = "abaabbbababbbabbaaa";
print scalar(() = /b+/g);
-->
5
Is that what you're after?
--
Bart.
- RFC 110 (v2) counting matches Perl6 RFC Librarian
- Re: RFC 110 (v2) counting matches Bart Lateur
- Re: RFC 110 (v2) counting matches Mark-Jason Dominus
- Re: RFC 110 (v2) counting matches Bart Lateur
- Re: RFC 110 (v2) counting matches Mark-Jason Dominus
- Re: RFC 110 (v2) counting matches Bart Lateur
- Re: RFC 110 (v2) counting matches Nathan Wiger
- Re: RFC 110 (v2) counting matches Tom Christiansen
- Re: RFC 110 (v2) counting matches Mark-Jason Dominus
- Re: RFC 110 (v2) counting matches Uri Guttman
- Re: RFC 110 (v2) counting matches David L. Nicol
