Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple regular expression parser designed by Rob Pike and implemented in Go; a language Rob Pike designed.
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Regex Matcher

Brian Kernighan wrote about how Rob Pike implement a beautiful and simple regular expression matcher in C.

After discussing how complex existing regular expression packages were for their book Rob disappeared into his office appeared again in no more than an hour or two with the 30 lines of C code that subsequently appeared in Chapter 9 of TPOP. That code implements a regular expression matcher that handles these constructs:

c    matches any literal character c
.    matches any single character
^    matches the beginning of the input string
$    matches the end of the input string
*    matches zero or more occurrences of the previous character

This is a re-implementation of the same in a language Rob Pike later himself designed.

Full story:

Something went wrong with that request. Please try again.