The CACM paper that first described the construction and use of the NFA
for regular expression search mentioned the explosive nature of the lists
if duplicates aren't eliminated, and discusses the difficulties (and
correct handling) of a**.

It's worth reading in any case. The paper includes a program that
compiles the regular expression into machine code that emulates the NFA.
(It's a good exercise in puzzling out 7094 assembly code.) The compiling
variant has been used in several editors and even a version of grep. An
interpretive variant can be seen in the source code to Rob Pike's editor
`sam'.
[FYI, it's the same K. Thompson that later wrote most of Unix. -John]
--