Timo,
Thank you, that works very nicely. But I'm committed to s///; instead
of .subst
Best I've been able to do is such as:
$text ~~ s:g/ using \s+ RMA.Rhino (\W) /{$res="using Rhino$0"}$res/;
say $res;
which works but makes the s///; quite a bit less readable.
Thank you,
Peter Schwenn
p.s. by the way
$res = ($text ~~ s:g/ using \s+ RMA.Rhino (\W) /using Rhino$0/;)
simply sets $res to True or False as you probably knew
On Thu, May 22, 2014 at 8:29 PM, Timo Paulssen <[email protected]> wrote:
>
> On 05/23/2014 01:57 AM, Peter Schwenn wrote:
> > Dear Perl6-users,
> >
> > I'd like to print out the string value of the "replacement" after a
> > match from a statement like:
> > s/pattern/replacement/; or its .subst version.
> >
> > (I'm able to print out the /pattern/ (match) string simply by printing
> > $/ ).
> >
> > Does the /replacement/ have a name so I can print it out too.
> >
> > Thank you,
>
> Hello Peter,
>
> > perl6-m -e 'my $text = "hello world"; my $res = $text.subst(/<alpha>+
> \s+ <( <alpha>+ )>/, "heya!"); say $res.perl;'
> > "hello heya!"
>
> Is this at all what you're looking for?
>
> Cheers,
> - Timo
>
>