Next Regular Expression Mastery 18

Backtracking

/cat|dog/

             START            |c a r i c a t u r e
                |             |c a r i c a t u r e
                 c            |c a r i c a t u r e         Yes!
                 a            <c|a r i c a t u r e         Yes!
                 t            <c a|r i c a t u r e         Nope.
                 d            |c a r i c a t u r e         Nope. 
             START             c|a r i c a t u r e
                |              c|a r i c a t u r e
                 c             c|a r i c a t u r e         Nope.
                 d             c|a r i c a t u r e         Nope.
             START             c a|r i c a t u r e
                |              c a|r i c a t u r e
                 c             c a|r i c a t u r e         Nope.
                 d             c a|r i c a t u r e         Nope.
             START             c a r|i c a t u r e
                |              c a r|i c a t u r e
                 c             c a r|i c a t u r e         Nope.
                 d             c a r|i c a t u r e         Nope.
             START             c a r i|c a t u r e
                |              c a r i|c a t u r e
                 c             c a r i|c a t u r e         Yes!
                 a             c a r i<c|a t u r e         Yes!
                 t             c a r i<c a|t u r e         Yes!
                 END           c a r i<c a t>u r e         Yes!



Next Copyright © 2002 M. J. Dominus