Alina
Alina

Reputation: 37

Google BigQuery extract string from column with regexp_extract - string value

I know there's similar question, but in my case the solution didn't work since there's no valid delimiter.

I have a string inside a column:

{"module-version": "2.0", "more-details-link": ""}, "has-cve": true, "issue-package": "VM-Essentials", "legacy-scan-status": "removed"}

I need the inside of issue-package. I tried: REGEXP_EXTRACT(details_issues.issue_raw,r'\"issue-package=(.+?)\,')

But i'm getting Null inside the column. Any suggestions?

Upvotes: 0

Views: 83

Answers (1)

Jeff Meatball Yang
Jeff Meatball Yang

Reputation: 39027

If this is a JSON string, you should use JSON_* functions instead.

You can try something like:

JSON_EXTRACT(details_issues.issue_raw, '$.issue-package')

Upvotes: 1

Related Questions