replace-with
ErrorsCollection

replace-with

Synthesised documentation from type/Match

From type/Match

See Original text in context

multi method replace-with(Match:D: Str() $replacement --> Str:D)

Returns the invocant string where the Match object is replaced by $replacement.

my Str $some-string = "Some foo";
my Match $match = $some-string.match(/foo/);
my $another-string = $match.replace-with("string"); # «Some string»