Boyer-Moore

Pattern-matching algorithm with pattern preprocessing and skips along portions of the text. Works better on longer alphabet sets.

indexOfBM()

/**
 * Finds pattern enclosure in the source string using Boyer-Moore algorithm.
 *
 * @param source Source string.
 * @param pattern Pattern string.
 * @returns The leftmost index at which the pattern begins in the source string or -1.
 */
function indexOfBM(source: string, pattern: string): number;

Last updated

Was this helpful?