Skip to content

What resources should one consult if one wanted to build a regex library from scratch? #1078

Answered by BurntSushi
sam0x17 asked this question in Q&A
Discussion options

You must be logged in to vote

Russ Cox's article series was the single most important bit: https://swtch.com/~rsc/regexp/

Otherwise, the source code of the RE2 and Go regexp engines is something I've read quite a bit over the years.

Note that this is pretty biased in favor of regex engines based on finite automata. This might not be a good path to go down if you want to write a backtracker, which is likely necessary in order to support things like look-around or backreferences.

Also, if I were me from 10 years ago, I would have loved to have this (shameless plug): https://blog.burntsushi.net/regex-internals/. In particular, it gets into a lot more of the engineering details of the regex engine than I think Cox's artic…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants