There is a lovely description of the classic Thompson algorithm of building an NFA from a regular expression and then simulating the NFA with a DFA using two stacks :) in the "Compilers" book by Aho et al. There is also a great article from Russ Cox on it:
http://swtch.com/~rsc/regexp/regexp1.html
I recommend implementing this as an exercise, rarely do you see that much classic CS theory put to a practical use in one place.
I recommend implementing this as an exercise, rarely do you see that much classic CS theory put to a practical use in one place.