2021. júl 10.

Bigquery Split Words with Regex

írta: dataanalyticsdemo
Bigquery Split Words with Regex

with prep as (
select 'John Doe' as name union all select 'Jane Doe' union all select 'ABC DEF'
)
select *
,Regexp_extract(name,r'^(?:[^\s]*\s){0}([^\s]*)\s?') as Word0
,Regexp_extract(name,r'^(?:[^\s]*\s){1}([^\s]*)\s?') as Word1
from prep

If there are more parts, there are no errors to those who have less:

 Great, I love it.

Szólj hozzá