Yary,

I tried your examples out in REPL after reading Tobias and Timo's responses.

After the second example, I tried outputting the  result of '$/' which contains the  whole capture from the last regex match. My result was

> 'fosdffgg'.subst(/(f+)/,'( ' ~ $0 ~ ' )',:g)
( f )osd( f )gg
> $/
(「f」
 0 => 「f」 「ff」
 0 => 「ff」)
>
In addition, I recall that $0 is syntactic sugar for $/[0].

On 19/04/2020 22:53, yary wrote:
Question from today's Raku meetup. This works in a way I expect

> 'fosdffgg'.subst(/f+/,"( "~ * ~" )", :g);
( f )osd( ff )gg

This one, $0 gets the single f each time

> 'fosdffgg'.subst(/(f+)/,"( $0 )", :g);

( f )osd( f )gg

Bug or misunderstanding on my part?

-y

Reply via email to