Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Replace或regexp_用大文本中的另一个单词替换相似的单词_Sql_Oracle_Plsql - Fatal编程技术网

Sql Replace或regexp_用大文本中的另一个单词替换相似的单词

Sql Replace或regexp_用大文本中的另一个单词替换相似的单词,sql,oracle,plsql,Sql,Oracle,Plsql,我在pl sql中有一个字符串值。例如: 'BLABLA ((example12_ BLA** example_test() BLABLABLA()* example_12)' 我想用“示例”词替换所有类似的示例词。结果应该是这样的: 'BLABLA ((example BLA** example BLABLABLA()* example' 仅限示例单词后的最后一个字符 这个词((例12)应该是“((例 谢谢。这应该行得通 WITH dat AS (SELECT 'BLABLA (

我在pl sql中有一个字符串值。例如:

'BLABLA ((example12_ BLA** example_test() BLABLABLA()* example_12)'
我想用“示例”词替换所有类似的示例词。结果应该是这样的:

'BLABLA ((example BLA** example BLABLABLA()* example'
仅限示例单词后的最后一个字符

这个词((例12)应该是“((例

谢谢。

这应该行得通

WITH dat
     AS (SELECT 'BLABLA ((example12_ BLA** example_test() BLABLABLA()* example_12)'
                   AS str,
                'BLABLA ((example BLA** example BLABLABLA()* example' AS expected_op
         FROM   DUAL)
SELECT str,
       expected_op,
       TRIM (REGEXP_REPLACE (str, 'example[^ ]*( |$)', 'example ')) AS op
FROM   dat;

那么你的问题到底是什么呢?标题的措辞表明你知道一般的解决方案。你应该能够找出你需要的精确模式,也许可以通过阅读文档或通过谷歌搜索帮助。这个网站有很多关于如何使用这些Oracle函数的示例谢谢!!我正在搜索这个答案:REGEXP\u REPLACE(str,'example[^]*(|$)','example')