Brute-Force String Matching

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Brute-force string matching compares a given pattern with all substrings of a given text. Those comparisons between substring and pattern proceed character by character unless a mismatch is found. Whenever a mismatch is found, the remaining character comparisons for that substring are dropped and the next substring can be selected immediately. The visualization of this sliding selection window shows the selected characters in blue. The characters which are currently compared are printed in magenta. Note that brute-force searching usually involves automatic shifts upon mismatch to avoid unnecessary comparisons.

Contributed by: Michael Schreiber (March 2011)
Open content licensed under CC BY-NC-SA




Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.