Restore the match_regex more smartly.