Boyer-Moore Search

Over ten years ago, I came across a footnote in a book on parsing that mentioned a "Fast String Searching Technique". From the brief (and I mean footnote brief) description, I created a small C routine to perform this improved linear search.

Several years later, I found much more on this technique, commonly known as the Boyer-Moore algorithm. It seems my original attempt was pretty close to the full description, yet was missing the critical preparsing information that calculates the correct "slide" value.

What I *didn't* find in those other descriptions of Boyer-Moore was a nice chunk of usable code -- just bits 'n' pieces here and there. Here's a working Boyer-Moore function in C, with a small main() which demonstrates it's utility.

For more information, see J.S. Moore's description of the algorithm he created with R. Boyer at his Best Ideas page.

See the source here: bm.c.txt