Search code examples
sqlregexsplitgoogle-bigqueryextract

How to extract characters within brackets in Google Bigquery? [SQL]


I am attempting to only extract the values within the parentheses. I have attempted the following:

SPLIT(name, ' ')[OFFSET(1)]   

But thats runs into issues when there are multiple words in the name

enter image description here


Solution

  • select *,
      regexp_extract(name, r'\((.*?)\)')
    from your_table