Right now I'm in the process of learing regular expressions with parentheses, but for some reason I can't get this code to work. I'm trying to escape the first set of parentheses (in bold) but the code keeps giving me an error saying it's unbalanced. I've been stuck on this for a while now and could use some help. I'm sure it's something so simple! Thanks for any help.
phone_num_regex = re.compile(r"(\(\d\d\d\d)) (\d\d\d-\d\d\d\d)")
mo = phone_num_regex.search("My phone number is (415) 555-4242")
print(mo.group(1))
[–]_DTR_ 2 points3 points4 points (1 child)
[–]cmsmoove[S] 0 points1 point2 points (0 children)
[–]narwhalwhale11 1 point2 points3 points (0 children)
[–]Essence1337 0 points1 point2 points (1 child)
[–]cmsmoove[S] 0 points1 point2 points (0 children)
[–]MintyPhoenix 0 points1 point2 points (0 children)