Relating a pattern to text positions

Exact substring search asks whether all pattern characters occur contiguously at some text position. A simple method tries each possible alignment, comparing from the start until a mismatch or full match.

The interface must specify first versus all occurrences, overlaps and empty-pattern behavior. Searching aa in aaaa has three overlapping starts, unlike a nonoverlapping extraction. An algorithm name does not itself settle that application contract.

References: [1]

Avoiding repeated work after mismatches

Retrying a length-m pattern across length-n text can repeat comparisons for O(nm) worst-case work. KMP reuses prefix information, Boyer–Moore computes safe shifts, and Rabin–Karp filters windows through rolling fingerprints.

Preprocessing can target a reusable pattern or a fixed text indexed for many future queries. Preparation and per-query costs must be separated rather than comparing only one scanning loop.

References: [1] [2] [3] [4] [5]

A character match does not establish identity

Matching units can be bytes, Unicode code points or grapheme clusters approximating user-perceived characters. Case, normalization and word-boundary policies require explicit rules, including a mapping back to original-text positions after transformations.

Finding a common word establishes a textual occurrence, not which namesake entity it denotes. Identity needs context and subject information. Allowing approximate occurrences within an edit distance introduces another matching condition rather than an automatic interpretation of exact hits.

References: [1] [6] [7] [8]