Regex into a function for expandability