Permalink
Browse files

Explain semantics of <( )> inside []* and ()*

fixes #60
  • Loading branch information...
1 parent 710337e commit 4128913f2b0c02386066a591ffbb933fb4260f43 @TimToady TimToady committed Sep 18, 2013
Showing with 14 additions and 3 deletions.
  1. +14 −3 S05-regex.pod
View
@@ -16,8 +16,8 @@ Synopsis 5: Regexes and Rules
Created: 24 Jun 2002
- Last Modified: 21 Aug 2013
- Version: 165
+ Last Modified: 18 Sep 2013
+ Version: 166
This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -1973,7 +1973,18 @@ based on those positions. For instance, after the match above, C<$()> contains
only the digits matched, and C<$/.to> is pointing to after the digits. Other
captures (named or numbered) are unaffected and may be accessed through C<$/>.
-These tokens are considered declarative, but may force backtracking behavior.
+When used directly within quantifiers (that is, within quantified
+square brackets), there is only one C<Match> object to set
+C<.from>/C<.to> on, so the C<< <( >> token always sets C<.from> to
+the leftmost matching position, while C<< )> >> always sets C<.to>
+to the rightmost position. However, the situation is different for
+capturing parentheses. When used within parentheses (whether or
+not the parens are quantified), the C<Match> being generated by each
+dynamic capture serves as the target, so each such capturing group
+sets its own C<.from>/C<.to>. Hence, if the group is quantified,
+each capture sets its own boundaries independently.
+
+These tokens are considered declarative.
=item *

0 comments on commit 4128913

Please sign in to comment.