Lucasaudati11
Lucasaudati11

Reputation: 577

selecting part of a string based on delimiter, from end of the string

So I have a column with names. Examples are the following

Mark (BB)

Andy White (CC)

The outcome I want is:

Mark

Andy White

StandardSQL in BQ does not accept RIGHT so I am struggling in starting a regexp from the end of the string.

I am not sure if trying to catch all what's inside the bracket (and bracket itself) or to try to catch the first space " ".

Can anybody help me?

Upvotes: 1

Views: 40

Answers (1)

Lucasaudati11
Lucasaudati11

Reputation: 577

Got an answer:

REGEXP_EXTRACT(column_name, r"([^\(]+)")

Just needed to try more with the regular expression.

Upvotes: 1

Related Questions