On Fri, 15 Dec 2000, Jonathan Scott Duff wrote:

> On Fri, Dec 15, 2000 at 01:13:13PM -0500, Deven T. Corzine wrote:
> > Not at all.  I don't want it to keep looking after it finds the first
> > match.  I want it to make sure that match isn't unnecessarily long, if
> > non-greedy matching was in use.  Conceptually (I don't think this would be
> > a good implementation), you find the first match as the current engine
> > does, then search for the smallest possible match WITHIN that first match.
> 
> This still sounds like "keep looking after it finds the first match"
> to me.

No, it's "find the first match and trim it if necessary to be less greedy".

> > Since it will already be as short as possible from the starting point, this
> > amounts to advancing the starting point as far as possible without changing
> > the ending point, as long as it still matches.
> 
> Given that the behavior you are looking for is already available and
> under programmer control, what are you really asking for?  Do you want
> the default behavior of the RE engine to change and if so, how would
> we get the current behavior?

I've yet to see a concrete example of where the current behavior is
helpful, but it would be a matter of changing the regexp to be what you
actually want.  For the specific example I gave, "b+.*?d" would match
"bbbbccccd" under the current behavior AND with my proposed behavior -- but
I'm still having a hard time thinking of a real-life case where the current
behavior would actually make life easier for the programmer...

Deven

Reply via email to