refactoring regex to simplify and incorporate feedback