In text search, the pattern is the string looked for, of length , in a text of length . An occurrence of the pattern is a position of the text with text[i:i + m] == p. Placing the pattern under the text from position is called an alignment; there are of them.
plan. Each row is one alignment; the boxed letter is the one compared, the grey letters are never looked at. In ordinary text most alignments fail at the first or second letter, so the search makes a little more than one comparison per position.