@TrisH0x2A: Rob Pike wrote a complete regular expression matcher in about 30 lines of C it supports ^, ., *, and $ using only recur…
Summary
A tweet highlights Rob Pike's classic 30-line regular expression matcher in C, demonstrating recursion and pointer arithmetic as an introduction to regex engines.
View Cached Full Text
Cached at: 08/04/26, 04:01 AM
Rob Pike wrote a complete regular expression matcher in about 30 lines of C
it supports ^, ., *, and $ using only recursion and pointer arithmetic
it’s still one of the best introductions to how regex engines actually work https://t.co/4RzVArGpUs
Similar Articles
Regular expressions that work "everywhere"
The article discusses the challenges of regex portability across tools like sed, awk, grep, and Emacs, and provides a subset of regex features that work reliably across these environments.
The true power of regular expressions (2012)
This article explains that modern regex engines like PCRE can parse far more than regular languages, debunking the common claim that HTML cannot be parsed with regex.
what 262,715 regex questions on stack overflow haven't answered
The author analyzes 262,715 Stack Overflow questions to identify common regex pain points and demonstrates how their new regex engine, RE#, solves these issues using complement and intersection operations.
Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
Nicholas Carlini's project implements a 2-ply minimax chess engine using 84,688 regular expressions, executed sequentially to play valid chess moves. The post explains the design of a regular expression computer that interprets instructions.
Readable Regular Expressions for JavaScript/TypeScript, Inspired by Emacs' rx
This article introduces a small JavaScript/TypeScript DSL inspired by Emacs' rx macro that lets developers write regular expressions as readable trees of named forms instead of opaque strings. It explains the internals (atoms, seqs, alts, quantifiers) and provides a cheat sheet, side-by-side examples, and a gist with the full source.