updated regexes to handle utf-8 correctly