Skip to content

Commit 2f734db

Browse files
committed
Document & and && in regexes. Closes #1145
1 parent 1bbe316 commit 2f734db

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/Language/regexes.pod6

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,19 @@ the lexical ordering in the regexes.
475475
476476
say ('abc' ~~ / a | .b /).Str; # OUTPUT: «ab␤»
477477
478+
=head1 X<Conjunction: C<&&>|regex,&&>
479+
480+
Matches successfully if all `&&`-delimited segments match the same substring
481+
of the target string. The segments are evaluated left to right.
482+
483+
This can be useful for augmenting an existing regex. For example if you have
484+
a regex `quoted` that matches a quoted string, `/ <quoted> && <-[x]>* /`
485+
matches a quoted string that does not contain the character `x`. Note that you
486+
cannot easily obtain the same behavior with a look-ahead, because a look-ahead
487+
doesn't stop looking when the quoted string stops matching.
488+
489+
=head1 X<Conjunction: C<&>|regex,&>
490+
478491
=head1 Anchors
479492
480493
The regex engine tries to find a match inside a string by searching from

0 commit comments

Comments
 (0)