Reputation: 19
Can anyone please help in a query(Using BigQuery/GoogleSQL) that can remove an extra dot com in an email address, for example : [email protected] I have tried using regexp replace but unable to define a search for second dot in the string.
Thank you.
Upvotes: 1
Views: 482
Reputation: 172974
Consider below approach
select email, regexp_replace(email, r'.com.com$', '.com') as email_out
from your_table
if to apply to dummy data like in below cte
with your_table as (
select '[email protected]' email union all
select '[email protected]' union all
select '[email protected]' union all
select '[email protected]'
)
the output is
Upvotes: 1
Reputation: 520948
To remove an extra .com
from a .com.com
ending, use:
SELECT email, REGEXP_REPLACE('\.com\.com$', '.com', email) AS email_out
FROM yourTable;
Upvotes: 0