refactor assertRegex