Next Regular Expression Mastery 30

Anti-Greed

Ungreedy Version

/a+?(a|b)/

             START             |a a a b
             a                 |a a a b         Yes!
             +                 <a|a a b
              |                <a|a a b         Nope
               a               <a|a a b         Yes!
               END             <a a>a b         Yes!



Next Copyright © 2002 M. J. Dominus