Apologies for the ambiguous title, but I don't know how to word my problem in such a way that makes sense in a single sentence.
So I have some simple regex code to extract code between brackets.
^.*\((.*)\).*
This successfully works in Python with the following code.
m = re.search( "^.*\((.*)\).*" ,input)
if m:
print(m.groups()[0])
My problem occurs when a closing bracket )
may be inside the outermost brackets. For example, my current code when given
nsfnje (19(33)22) sfssf
as an input would return
19(33
but I would like it to return.
19(33)22
I'm not sure how to fix this, so any help would be appreciated!