On Wed, 28 Aug 2002, Deven T. Corzine wrote: > Would it be better for the matching of (Jun|June) to be "undefined" and > implementation-dependent? Or is it best to require "leftmost" semantics?
For an alternation spelled out explicitly in the pattern, it seems like undefined matching would be confusing. I regularly order the branches of regexes assuming they are tried left-to-right. On the other hand, and on a related note of constrained implementation, do we require leftmost matching for interpolated arrays of literals (e.g. "/@x/")? If, as with hyper-operators, we said the order of evaluation is undefined, we could use a fast algorithm (Aho-Corasick?) that doesn't preserve order. /s