Hi all,

Thanks Bill for posting your results from my samples. Seems like we both
get lots of warnings/errors from our REPL's, me even with 2021.02.01. I
suspect there must be something going on with what the REPL is trying to
print, after all it does want to display the results of every line. I
haven't looked at that since the first post, was more interested in the
capturing-or-not rules displayed by the code run from a file than tracking
down the REPL output. Maybe I'll look into it again next weekend, need to
get back to $work today!

Thanks Raiph for the continued examples, this one in particular showing how
to get all nested captures worked for me. While I'm not sure I agree with
the design, it is consistent, and perhaps I will internalize this over time.

On Fri, Mar 19, 2021 at 7:14 PM Ralph Mellor <ralphdjmel...@gmail.com>
wrote: ...

>
> A Raku equivalent:
> my $word = '(\w+)';
> my $AwithB = "$word ' with ' $word";
> my $regex = "$AwithB .* 'is ' $word";
> $_ = 'Interpolating regexes with arbitrary captures is fun!';
> .say for m/<top=$regex>/.<top>.pairs;
> displays:
>  0 => 「regexes」
>  1 => 「arbitrary」
>  2 => 「fun」
> ----
> > Raku example:
> >
> > my $word = /(\w+)/;
> > my $AwithB = /$word' with '$word/;
> If you interpolate by using `$abc...` or `<$abc...>` instead of `<abc...>`,
> Raku will by default not capture. And the non-capturing is nested, so
> throwing away those captures also throws away the corresponding
> capture within `$word`.


-y

Reply via email to