Applies a regular expression (regex) to a string and returns information on the first matched substring.