Dear David Waring,

Thank you for your example.  It works and I understand it.

I take it from your example that with a predefined regex pattern one may
only be able to get ONE capture.  I want to use a predefined pattern with
more than one capture in an s///; form, like what you've written (which
implicitly captures the whole of the pattern) but, for example, with two
captures:

my $x= " (\W) ion (<[\d]>) dPoint ";
my $s= "+ion3dPoint";
$s ~~ s/<$x>)/Point$1d$0/;
say $s;
OUTPUT Point3d+

(I'm not using the predefined pattern for "compiled" performance, but to
reduce error-prone redundancy in my program.)

Any ideas?

Peter Schwenn

P.S. In future I will use the IRC or the perl6-user mailing list for non-
bugs.


On Wed, May 21, 2014 at 11:33 PM, David Warring via RT <
perl6-bugs-follo...@perl.org> wrote:

> Hi Peter,
>
> I've tried the following on rakudo:
>
>     $ perl6 -e'my $x=/bb|dd/; my $s = "addc"; $s ~~ s/<$x>/ZXZ/; say $s'
>     aZXZc
>
> Which is working.
>

David

Reply via email to