Moved regular expression out of the _transform function.