moved regexes into one function