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 Word1from prep
If there are more parts, there are no errors to those who have…