Russ Cox's three-parter on Implementing Regular Expressions is worth a read if you've got a thing for deep theory and implementation details on finite-state automata.