I wrote this regex to identify US type phone numbers:
\(?\d{3}\)?(-|\s)\d{3}-\d{4}
This works for phone numbers like:
217-244-2424 and (217) 244-2424.
However it also works for unbalanced parenthesis like (217-244-2424
How can the regex be improved to make sure the parenthesis are balanced? (I'm aware of the questions on regex phone numbers asked before, but I couldn't find what I was looking for from there.)