How to make a more efficient solution (Regex to find mistakes in parenthesis)

this may help you