I'm trying to get the innermost sub-string for () in the below string using Python:
x = "a (b) (c (d) e"
what I want below sub-string as output
(d)
what I tried till now is as below
re.findall(r"\(.*?\)", x)
re.findall(r"\(.*\)", x)
but it gives me output as the outer strings and that is not useful.
I want to match the innermost string which is available between ( ).
This example is part of another complex string and this string aptly displays my issue. I require the regex solution only with the parentheses.