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, perl6-users@perl.org
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
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
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.
[ 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[ alpha+(\W) ]