Qan*_*iat 3 regex sql oracle oracle-sqldeveloper
我想为所有事件替换不区分大小写的字符串
给定的查询将所有吨替换为码.但是,它区分大小写.
SELECT regexp_replace(col_name, 'tons', 'yard') FROM DUAL;
Run Code Online (Sandbox Code Playgroud)
如何编写一个替换所有出现的查询,而不管字母大小写.我尝试了这个但是没有用:
SELECT regexp_replace(col_name, 'tons', 'yard', 'i') FROM DUAL;
Run Code Online (Sandbox Code Playgroud)
谢谢
小智 7
使用'i'选项是正确的,但您之前缺少两个参数.
REGEXP_REPLACE(<source_string>, <pattern>,<replace_string>, <position>, <occurrence>, <match_parameter>)
Run Code Online (Sandbox Code Playgroud)
对于位置,使用1开始搜索.出现时,使用0替换每次出现.
SELECT regexp_replace(col_name, 'tons', 'yard', 1, 0, 'i') FROM DUAL;
Run Code Online (Sandbox Code Playgroud)