Brian Kernighan and Rob Pike wrote a regex matcher in a few dozen lines of C

blaizedsouza · x · 2026-09-03

A retweeted classic: Unix legends Brian Kernighan and Rob Pike implemented a regex matcher in just a few dozen lines of C, supporting ^, $, ., and . The entire matcher works through recursion and pointer arithmetic — a timeless example of elegant, minimal code from The Practice of Programming.

Original post →

More from coding & agent

coding & agent channel →