Re: match's replacement name?

2014-05-24 Thread perl6-users
On 05/23/2014 09:08 PM, Peter Schwenn wrote: > Timo, perl6-users, > > I don't want to print out the WHOLE text resulting from the match (in > my case a long file,) but just the /replacement/ string. > > [...] > > Peter Schwenn > > On Thu, May 22, 2014 at 9:58 PM, > wr

Re: match's replacement name?

2014-05-23 Thread Peter Schwenn
Patrick, I would agree with you that saving all the replacements does NOT warrant the overhead. Saving how many matches were made would not be at all heavy overhead, but again, its easy to do in a closure so that too is not really necessary. Just takes awhile to learn how to use the closures. T

Re: match's replacement name?

2014-05-23 Thread Patrick R. Michaud
On Fri, May 23, 2014 at 03:08:38PM -0400, Peter Schwenn wrote: > Still it would be more straightforward to have something like > $layn ~~ s:g/ (\W) [[RMA\.]? OpenNURBS\.]? I? On (<[2..4]>) dPoint > /$0Rhino.Geometry.Point$1d/; > and have a more perl6-built-in way of getting hold of the /replac

Re: match's replacement name?

2014-05-23 Thread Peter Schwenn
Timo, perl6-users, I don't want to print out the WHOLE text resulting from the match (in my case a long file,) but just the /replacement/ string. I'm sticking with syntax such as (which is also - for me - readable) $layn ~~ s:g / (\W) [[RMA\.]? OpenNURBS\.]? I? On (<[2..4]>) dPoint /{""if++$

Re: match's replacement name?

2014-05-22 Thread perl6-users
[ Sorry for not replying to the whole list earlier, I hope all readers will be able to cope with fishing my reply out of the full-quotes. ] Peter, Here's what I came up with using the assignment variant of the substitution operator: > perl6-m -e 'my $text = "Well, hello!"; $text ~~ s[ +(\W) ] =

Re: match's replacement name?

2014-05-22 Thread Peter Schwenn
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

match's replacement name?

2014-05-22 Thread Peter Schwenn
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 pri