Patches to the regular expression and string generation