On Tue, Nov 08, 2005 at 10:55:05AM -0500, Matt Fowles wrote: > Patrick~ > > On 11/8/05, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > > On Tue, Nov 08, 2005 at 12:57:18PM +0000, [EMAIL PROTECTED] wrote: > > > "Patrick R. Michaud" <[EMAIL PROTECTED]> wrote: > > > :And we also get \d:0123 as a cheap way of saying \d<?null>0123. > > > > > > I think the ':' changes the meaning of the rule, so you still need > > > '\d<?null>0123' (or preferably something shorter) for the uncut semantic. > > > > Not really; the ':' (as 'cut') simply means to not retry the > > preceding atom, and in this case since the previous atom has > > no backtracking associated with it already (a '\d' matches a single > > digit or fails), so the ':' is effectively a no-op. In fact, > > in PGE '\d' and '\d:' generate exactly the same code. > > While that is true for the rule /\d:0123/ it is not for /.*\d:0123/, > as preceding backtracking options may need to be explored. If I > understand this correctly....
In the case of /.*\d:0123/, the previous "atom" for the cut is still just the '\d' -- the '.*' is a different "atom". When someone writes / .\d* / we understand that the '*' quantifier applies only to the previous atom (the '\d') and not the '.' in front of it. The same is true for things like /abc*/ -- the atom being quantified is the "c", not the full "abc" literal. So, when S05 says that ':' doesn't retry the previous atom, I'm interpreting it the same way. In order to cut both the .* and the \d, one would write either /[.*\d]:/ or /.*:\d/ . Pm