In PostgreSQL, I have a text value foo (text1) bar (text2)
, I want to regex match and extract all the texts between parentheses
SELECT REGEXP_MATCHES('foo (text1) bar (text2)', '\((.*)\)', 'g')
I got this response:
regex_matches
-------------------
{text1) bar (text2}
I expect the output to be:
regex_matches
-------------------
text1
text2