'Regex to extract string inside X number of parentheses

I can't come up with a regex that would extract all strings inside different number or parentheses or curly braces.

For example I can have this different inputs:

requires = (( ('STRING'), ('STRING') ))
requires = ( ('STRING'), ('STRING') )
requires = ( 'STRING', 'STRING' )
requires = ['STRING', 'STRING']

They are always inside the requires variable, and they can come up in different setups as you can see above. But the inputs above are also wrapped with text around.

Basically I get a raw string from a file and I need to extract what is inside the requires without the parentheses or curly braces.

What I have so far is 3 different regex to match the different number of parentheses:

"(?: requires = [[(](.*)[)])"
"(?: requires = [(][(](.*)[)][)])"
"(?: requires = [(][(][(](.*)[)][)][)])"


Solution 1:[1]

Write a generalized regex that doesn't care about how many parentheses, or trying to match them:

requires = [\(\[\s]+'([^']*)'[^']*'([^']*)

Here capture group 1 will contain the first STRING and capture group 2 will contain the second STRING, regardless of parentheses. This solution assumes that the STRINGs are always encapsulated by ' and never contain ' themselves.

You can test it here: https://regex101.com/r/xGGnlw/1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MostlyArmless