MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: [SERVER] ALPHA release of LambdaMOO server 1.7.9



Gustavo Glusman writes:
> Date: Thu, 28 Sep 1995 11:12:41 -0700
> 
> >   ********** The old GNU regex package had a bug in its handling of certain
> >   ** NOTE ** patterns with parentheses in them, and it is reasonably likely
> >   ********** that many MOO programmers have, perhaps unconsciously, come to
> >   depend upon this buggy behavior.  Unfortunately for such programmers, RX
> >   does not have this bug, so you will want to fix your regular expressions
> >   before upgrading to this release; the fixed patterns will work correctly
> >   on both releases.
> >   The old bug concerns patterns of the form `%( ... %)*', that is, a
> >   starred parenthesized sub-pattern; for example, consider the MOO
> >   expression
> >           match("foo", "%(o%)*")
> >   Using the old regex package, this returns
> >	      {2, 3, {{2, 3}, {0, -1}, ...}, "foo"}
> >   which is *wrong*; the last successful match of the parenthesized
> >   sub-pattern covered just the third character, not the second and third
> >   ones.  Using the new RX package, this expression returns the proper
> >   value:
> >	      {2, 3, {{3, 3}, {0, -1}, ...}, "foo"}
> 
> Oh great. I just tried ;match("foo", "%(o%)*") in both 1.7.8p4 and 1.7.9a1.
> 1.7.8p4 returns => {1, 0, {{0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0,
> -1}, {0, -1}, {0, -1}, {0, -1}}, "foo"}
> 1.7.9a1 returns => {1, 0, {{0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0,
> -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0,
> -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0,
> -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}, {0, -1}}, "foo"}

These are both correct values; it's the example that's wrong.  The first
possible match for this pattern in the string "foo" is the empty string right
at the beginning.  If you use `+' instead of `*', then you get the results
quoted above.  Sorry for the confusion.

	Pavel



Home | Subject Index | Thread Index