On 19 September 2012 02:15, David Knipe <pure.mathmo@googlemail.com> wrote: > I see two problems with this: > (1) For the lazy match, it still gives the same result as the > documentation file suggests. For lazy match isn't it just: S{0,1}= S?? S{1,2}= SS?? S{1,3}= SS??S?? S{2,4}= SSS??S?? And it seems to me that Zeframs and my definitions are the same. > (2) It could be taken to mean that the interpreter tries out all possible > combinations, which could drastically slow things down. For instance, if S > is just a single character, it could (in some hypothetical worst-case > scenario) have to try 2**n combinations just to match S{0,n}. If n=3, the > combinations would be: (S)(S)(S), (S)(S)(), (S)()(S), (S)()(), ()(S)(S), > etc. Presumably, it is in fact intelligent enough not to try (S)(S)(), > (S)()(S) and ()(S)(S) separately, in which case the number of things to try > is only linear. This is a comment about how the regexp engine implements the match, not what it legally can match. It seems to me that in a formal definition we only need the latter. YvesThread Previous