String matching is one of computing’s fundamental problems: given a pattern of length m and a text of length n, find all occurrences of the pattern within the text. The naive approach—sliding the…
Read more →
Wildcard pattern matching is everywhere. When you type *.txt in your terminal, use SELECT * FROM in SQL, or configure ignore patterns in .gitignore, you’re using wildcard matching. The problem…
Read more →
You have a list of 10,000 banned words and need to scan every user comment for violations. The naive approach—running a single-pattern search algorithm 10,000 times per comment—is computationally…
Read more →
Pattern matching is one of Rust’s most powerful features, fundamentally different from the switch statements you’ve used in C, Java, or JavaScript. While a switch statement simply compares values,…
Read more →
Regular expression matching with . (matches any single character) and * (matches zero or more of the preceding element) is a classic dynamic programming problem. Given a string text and a…
Read more →
Pattern matching is one of those features that, once you’ve used it properly, makes you wonder how you ever lived without it. At its core, pattern matching is a control flow mechanism that…
Read more →
You need to scan a document for 10,000 banned words. Or detect any of 50,000 malware signatures in a binary. Or find all occurrences of thousands of DNA motifs in a genome. The naive approach—running…
Read more →