Skip to content

Commit a651021

Browse files
Márton Polgárcoke
authored andcommitted
Making %% for regexes more noticeable and precise
1 parent 75fb192 commit a651021

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/Language/regexes.rakudoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,11 @@ exception will be thrown:
864864
To more easily match things like comma separated values, you can tack on a
865865
C<%> modifier to any of the above quantifiers to specify a separator that must
866866
occur between each of the matches. For example, C<a+ % ','> will match
867-
C<a> or C<a,a> or C<a,a,a>, etc. To also match trailing delimiters
868-
( C<a,> or C<a,a,> ), you can use C<%%> instead of C<%>.
867+
C<a> or C<a,a> or C<a,a,a>, etc.
868+
869+
C<%%> is like C<%>, with the difference that it can optionally match trailing
870+
delimiters as well. This means that besides C<a> and C<a,a>, it can also match
871+
C<a,> and C<a,a,>.
869872

870873
The quantifier interacts with C<%> and controls the number of overall
871874
repetitions that can match successfully, so C<a* % ','> also matches the empty

0 commit comments

Comments
 (0)