Skip to content

Commit ba2cbe8

Browse files
authored
Document .subst-mutate returns a List when :g is used
1 parent ac4b28c commit ba2cbe8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/Type/Str.pod6

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,10 @@ regex, not the C<subst> method call.
721721
722722
Where C<subst> returns the modified string and leaves the original
723723
unchanged, it is possible to mutate the original string by using
724-
C<subst-mutate>. If the match is successful, the method returns a C<Match>
725-
object representing the successful match, or C<Any> otherwise.
724+
C<subst-mutate>. If the match is successful, the method returns a C<Match>
725+
object representing the successful match; if C<:g> (or C<:global>) argument
726+
is used, returns a C<List> of C<Match> objects. If no matches happen,
727+
returns C<Any>.
726728
727729
my $some-string = "Some foo";
728730
my $match = $some-string.subst-mutate(/foo/, "string");

0 commit comments

Comments
 (0)