Compute words from a regular expression