In computer programming and computer science, "maximal munch" or "longest match" is the principle that when creating some construct, as much of the available input as possible should be consumed.
The earliest known use of this term is by R.G.G. Cattell in his PhD thesis[1] on automatic derivation of code generators for compilers.