Am 04.05.2014 23:22, schrieb schw...@rt.perl.org:
> # New Ticket Created by  Schwenn, Peter 
> # Please include the string:  [perl #121798]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=121798 >
>
>
> Dear Perl6'ers,
>
> I am using 2014.3 Star’s MSI to build a production translator (updating about 
> 1000 C# source files to be compatible with new libraries).
>
> I have successfully written a mass of substitutions based on the s/// form.
>
> Now I'm trying to count the matches that have been made, so because one can't 
> count s:g/// matches (apparently), I'm  pairing an m:ex/.../ {say ... } with 
> each s:g///;, using the same matching pattern.
>
> But " ~~ m:ov/.../" and "m:ex/.../" and "ms:g/.../" all seem to be broken in 
> the sense that they won't even find multiple matches (or if they do they 
> won't store or report them according to S05.)
>
> For example,
>
>> say "abracadabra" ~~ m:ov/a+/
> False
>
>> say "abracadabra" ~~ m:ex/a(.*)a/
> False
>
> and nothing is ever reported by
> if $str ~~ m:ex/.../ {say [$/];}
> same for m:ov/...,
> same for ms:g/...,
> and same for using @() instead of [$/]
>
> In fact no example from S05 that deals with reporting or storing multiple 
> matches with "~~ m.../" works.
>
> (Single match m/.../ seems to work fine AND report the number of matches i.e. 
> 0 or 1) by either +[$/] or +@() )
>
> [In short I am looking for any way of reporting multiple matches.]
>
> Thank you,
>
> Peter Schwenn
>
>
>
Hi, it seems like the method form works where the m// does not...

<FROGGS> m: say "abracadabra" ~~ m:g/a+/
<camelia> rakudo-moar fd5f8e: OUTPUT«False␤»
<FROGGS> m: my $m = "abracadabra".match(/a+/, :g); say $m; say $m.elems
<camelia> rakudo-moar fd5f8e: OUTPUT«「a」␤ 「a」␤ 「a」␤ 「a」␤ 「a」␤␤5␤»

Does that help you here?

Cheers, FROGGS

Reply via email to