In Match§
See primary documentation in context for method replace-with.
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»