Maximal munch (or the longest match) is the rule that the next token is the longest prefix of the remaining input that belongs to some token class. The priority rule breaks the remaining ties: when that longest prefix belongs to several classes, the class of the rule written first wins.
a and a*b. Each scan reads to the end of the input hoping for a b (black arrow), then backs up to the end of the one-character token it had already accepted (red arrow, shaded token).