made the regexes more robust for hw4