Ah, I think I realize why I wasn't getting it.
It's not just a flat loop through all the quantifiers.
It's reallly a recursive approach.
This makes things a bit more complicated for me.
Oh well.
 
Thanks all.
Greg

________________________________

From: Ronald J Kimball [mailto:[EMAIL PROTECTED]
Sent: Wed 2/1/2006 5:38 PM
To: Greg London
Cc: [email protected]
Subject: Re: [Boston.pm] quantifiers in regular expressions



On Wed, Feb 01, 2006 at 02:55:19PM -0500, Greg London wrote:
> I'm trying to understand how multiple quantifiers in a
> regular expressions get massaged to fit the data.

The Mastering Regular Expressions book has a chapter on the Mechanics of
Regular Expressions which might be helpful.

Basically, the regex engine keeps track of every decision it makes (such as
whether or not to match an additional iteration for the * quantifier).
When the matching fails, the regex engine backtracks to the last decision
it made and tries the other choice.

Ronald


 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to