我尝试从句子字符串中删除特殊字符和数字,但是如果存在多个空格,则应忽略空格
SQL开发人员,oracle 11g
select REGEXP_REPLACE ('Annapurna1@ Poojari675&^','(\W|\d)','') from dual;
实际输出为AnnapurnaPoojari
,但我需要为Annapurna Poojari
答案 0 :(得分:2)
您可以更清楚地知道要保留的字符:
select REGEXP_REPLACE('Annapurna1@ Poojari675&^', '([^a-zA-Z ])', '')
from dual;
答案 1 :(得分:1)
您也可以使用[^[:alpha:] ]+
模式删除非字母字符并保留空格:
select regexp_replace('Annapurna1@ Poojari675&^','[^[:alpha:] ]','') as "Result String"
from dual;
Result String
-----------------
Annapurna Poojari