BigQuery 从位置不固定的电子邮件地址中删除字符串
BigQuery to remove a string from an email address whose position is not fixed
任何人都可以帮助查询(使用 BigQuery/GoogleSQL),该查询可以删除电子邮件地址中多余的点 com,例如:test@yahoo.com.com
我尝试使用正则表达式替换但无法定义对字符串中第二个点的搜索。
谢谢。
要从 .com.com
结尾删除多余的 .com
,请使用:
SELECT email, REGEXP_REPLACE('\.com\.com$', '.com', email) AS email_out
FROM yourTable;
考虑以下方法
select email, regexp_replace(email, r'.com.com$', '.com') as email_out
from your_table
如果像下面的 cte 一样应用于虚拟数据
with your_table as (
select 'test@yahoo.com.com' email union all
select 'sample1@hotmail.com.com' union all
select 'Sample2@gmail.com.com' union all
select 'abc@gmail.com'
)
输出是
任何人都可以帮助查询(使用 BigQuery/GoogleSQL),该查询可以删除电子邮件地址中多余的点 com,例如:test@yahoo.com.com 我尝试使用正则表达式替换但无法定义对字符串中第二个点的搜索。
谢谢。
要从 .com.com
结尾删除多余的 .com
,请使用:
SELECT email, REGEXP_REPLACE('\.com\.com$', '.com', email) AS email_out
FROM yourTable;
考虑以下方法
select email, regexp_replace(email, r'.com.com$', '.com') as email_out
from your_table
如果像下面的 cte 一样应用于虚拟数据
with your_table as (
select 'test@yahoo.com.com' email union all
select 'sample1@hotmail.com.com' union all
select 'Sample2@gmail.com.com' union all
select 'abc@gmail.com'
)
输出是