Generating regular expressions