oracle 从字符串中删除电子邮件ID

7uhlpewt  于 2023-05-16  发布在  Oracle
关注(0)|答案(2)|浏览(145)

我有一个包含多个电子邮件的字符串,只需要从字符串中删除电子邮件地址。尝试使用regexp,但不确定如何保留其他文本,但只删除电子邮件

David Ram:DRAM@info.au,Seja:SEJA@info.au,Yogan:YSGAN@info.au

查询:

SELECT REGEXP_REPLACE(TEXTAREA,':[a-zA-z0-9.]@[a-zA-z0-9.]*' )  FROM CONTEXT

输出:

David Ram,Seja,Yogan
yqkkidmi

yqkkidmi1#

这里有一个选择:

SQL> with test(col) as
  2    (select 'David Ram:DRAM@info.au,Seja:SEJA@info.au,Yogan:YSGAN@info.au' from dual)
  3  select regexp_replace(col, ':\w+@\w+\.\w+') result
  4  from test;

RESULT
--------------------
David Ram,Seja,Yogan

SQL>
xv8emn3q

xv8emn3q2#

demo

SELECT REGEXP_REPLACE(TEXTAREA,':(.*?),',',' )  
FROM (SELECT 'David Ram:DRAM@info.au,Seja:SEJA@info.au,Yogan:YSGAN@info.au'||',' TEXTAREA from dual)

相关问题