The -2 feels a little magic-numberey to me.  I'm guessing this is because of the `lastMatchedIndex + 1 === c` check below? (We don't want it to be true when c == 0).  But I think it'd be cleaner to use the standard -1 here and then change the check to `... && lastMatchedIndex !== -1`.