This is part of a larger regex, and the intention is for the entire string labeled test to match and fall into the capture group (with the exception of the first and last three parentheses).
As written, my understanding is that the regex should capture a string between one opening parentheses (
and three closing parentheses )))
.
Regex:\(([^\)\)\)]*)\)\)\)[\s]*,?
Test:((Test_1, (3.7, 88, test,, str)), (Test_2, (1.9, 33, test,, str))) ,
When used with Python's standard regex library, only (Test_2, (1.9, 33, test,, str))) ,
is actually matching the regex instead of the entire string. I must be missing something here, but I'm having a hard time figuring out what that is and how to resolve it.
test=r"((Test_1, (3.7, 88, test,, str)), (Test_2, (1.9, 33, test,, str))) ,"
re.compile(r"\(([^\)\)\)]*)\)\)\)[\s]*,?").search(test).group(0)
>>> '(Test_2, (1.9, 33, test,, str))) ,'