extended to be able to pass in own regexes