Reputation: 41
Is it possible to change the State_Name to California using regexp_replace()?
select REGEXP_replace("Name,Door_No,Street_Name,Area_Name,State_Name,12345", r"","California") AS example
Upvotes: 1
Views: 44
Reputation: 172993
One of the many options -
#standardSQL
SELECT REGEXP_REPLACE(
"Name,Door_No,Street_Name,Area_Name,State_Name,12345",
r"([^,]*,)([^,]*,)([^,]*,)([^,]*,)([^,]*)(,[^,]*)",
r"\1\2\3\4California\6"
) AS example
returns
Row example
1 Name,Door_No,Street_Name,Area_Name,California,12345
Upvotes: 2