Check if the regex is successful or not.