Applies a regular expression (regex) to a string and returns a boolean that indicates if a match is found or not.