Next Regular Expression Mastery 17

Backtracking

/cat|dog/

             START            |s c a t
                |             |s c a t
                 c            |s c a t                Nope. 
                 d            |s c a t                Nope. 
             START             s|c a t
                |              s|c a t
                 c             s|c a t                Yes!
                 a             s<c|a t                Yes!
                 t             s<c a|t                Yes!
                 END           s<c a t>               Yes!



Next Copyright © 2002 M. J. Dominus