Skip to content

Commit ff11f19

Browse files
committed
define %%; clarify that % is not quantmod
ingy++ requested a method of stopping optionally after the separator, so that's now %% (with some notion of "evenly divisible" in some kind of loose sense). (Note, if you want to require the separator at the end, don't use this construct, just use [x ',']* or such. sorear++ requested clarification: % (and %%) are not really quantifier modifiers; they modify a quantified atom to insert requirements between each iteration of that quantified atom. Hence any quantifier may still take an additional control quantmod in addition to a separator.
1 parent a455b11 commit ff11f19

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

S05-regex.pod

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Synopsis 5: Regexes and Rules
1717

1818
Created: 24 Jun 2002
1919

20-
Last Modified: 20 Sep 2011
21-
Version: 148
20+
Last Modified: 25 Sep 2011
21+
Version: 149
2222

2323
This document summarizes Apocalypse 5, which is about the new regex
2424
syntax. We now try to call them I<regex> rather than "regular
@@ -982,7 +982,7 @@ considered procedural rather than declarational.]
982982

983983
=item *
984984

985-
Any quantifier may be modified by an additional constraint that
985+
Any quantified atom may be modified by an additional constraint that
986986
specifies the separator to look for between repeats of the left side.
987987
This is indicated by use of a C<%> between the quantifier and
988988
the separator. The initial item is iterated only as long as the
@@ -1028,7 +1028,21 @@ matches the null string.
10281028

10291029
'' ~~ / <ident>* % ',' / # matches because of the *
10301030

1031-
If you wish to quantify each match on the left without the modifier, you must place it in brackets:
1031+
If you wish to allow the match to end after either side, use C<%%> instead.
1032+
Therefore
1033+
1034+
/ <ident>+ %% ',' /
1035+
1036+
can match any of
1037+
1038+
foo
1039+
foo,
1040+
foo,bar
1041+
foo,bar,
1042+
foo,bar,baz
1043+
foo,bar,baz,
1044+
1045+
If you wish to quantify each match on the left individually, you must place it in brackets:
10321046

10331047
[<a>*]+ % ','
10341048

@@ -1043,8 +1057,7 @@ back through the separator. Likewise, this matching of the separator
10431057
does not count as "progress" under C<:ratchet> semantics unless the
10441058
next item succeeds.
10451059

1046-
[Note: the following may be subject to change, now that this construct is
1047-
a quant modifier.] When significant space is used under C<:sigspace>,
1060+
When significant space is used under C<:sigspace>,
10481061
it applies on both sides of the separator, so
10491062

10501063
ms/<element>+ % ','/

0 commit comments

Comments
 (0)