Skip to content

Commit

Permalink
Explain semantics of <( )> inside []* and ()*
Browse files Browse the repository at this point in the history
fixes #60
  • Loading branch information
TimToady committed Sep 18, 2013
1 parent 710337e commit 4128913
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions S05-regex.pod
Expand Up @@ -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
Expand Down Expand Up @@ -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 *

Expand Down

0 comments on commit 4128913

Please sign in to comment.