Generalize regular expression