Author: larry Date: Fri Apr 27 08:46:01 2007 New Revision: 14385 Modified: doc/trunk/design/syn/S05.pod
Log: Correction noted by bsb++ Modified: doc/trunk/design/syn/S05.pod ============================================================================== --- doc/trunk/design/syn/S05.pod (original) +++ doc/trunk/design/syn/S05.pod Fri Apr 27 08:46:01 2007 @@ -14,9 +14,9 @@ Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and Larry Wall <[EMAIL PROTECTED]> Date: 24 Jun 2002 - Last Modified: 17 Apr 2007 + Last Modified: 27 Apr 2007 Number: 5 - Version: 57 + Version: 58 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I<regex> rather than "regular @@ -375,6 +375,8 @@ match at all possible character positions (including overlapping) and return all matches in a list context, or a disjunction of matches in a scalar context. The first match at any position is returned. +The matches are guaranteed to be returned in left-to-right order with +respect to the starting positions. $str = "abracadabra"; @@ -384,13 +386,20 @@ =item * -With the new C<:ex> (C<:exhaustive>) modifier, the current regex will match -every possible way (including overlapping) and return all matches in a list -context, or a disjunction of matches in a scalar context. +With the new C<:ex> (C<:exhaustive>) modifier, the current regex will +match every possible way (including overlapping) and return all matches +in a list context, or a disjunction of matches in a scalar context. +The matches are guaranteed to be returned in left-to-right order with +respect to the starting positions. The order within each starting +position is not guaranteed and may depend on the nature of both the +pattern and the matching engine. (Conjecture: or we could enforce +backtracking engine semantics. Or we could guarantee no order at all +unless the pattern starts with "::" or some such to suppress DFAish +solutions.) $str = "abracadabra"; - if $str ~~ m:exhaustive/ a (.*) a / { + if $str ~~ m:exhaustive/ a (.*?) a / { say "@()"; # br brac bracad bracadabr c cad cadabr d dabr br }