Reputation: 25
I am getting the following error: Regular expressions passed into extraction functions must not have more than 1 capturing group.
And this is what I am trying to extract : regexp_substr(UPPER(tags), r'(TG\d{6})|(BD\d{6})')
Does anyone know how can I change this to one capturing group?
Any help would be appreciated.
Upvotes: 1
Views: 1856
Reputation: 172993
Use either of below instead
regexp_substr(UPPER(tags), r'(TG\d{6}|BD\d{6})')
or
regexp_substr(UPPER(tags), r'(?:TG|BD)\d{6}')
Upvotes: 1