Anisa Daraputri
Anisa Daraputri

Reputation: 67

REGEXP_EXTRACT after a pattern

I'm really blind about regex. I want to extract after the word 'page='

page=course; uri=%2Fcourse
page=homepage

in this case it would be "course" and "homepage". I've tried

REGEXP_EXTRACT(context, r"(?<=page=)+[a-zA-Z]*")

but it said "Cannot parse regular expression: invalid perl operator: (?<" in Google BigQuery.

Any suggestions? Thank you!

Upvotes: 0

Views: 984

Answers (1)

Nick
Nick

Reputation: 147166

Google's regex library doesn't support lookbehinds, but you can use a capture group to get REGEXP_EXTRACT to return that substring instead of the entire match:

REGEXP_EXTRACT(context, r"page=([a-zA-Z]+)")

Upvotes: 1

Related Questions