如何使用regexp_replace删除pl / sql中单引号之间的字符

问题描述 投票:0回答:2

我想问一下是否有人知道如何使用regexp_replace删除pl / sql中单引号之间的字符。

就像这样。

The 'quick brown' fox jumps over the lazy dog.
--> The fox jumps over the lazy dog.

The 
'quick
 brown' 
fox jumps over 
'the lazy' dog.
--> The fox jumps over dog.
oracle plsql regexp-replace
2个回答
1
投票
select regexp_replace('The ''quick brown'' fox jumps over the ''lazy'' dog', 
                 '''.*?''', '', 1, 0, 'm')
from dual    

OUTPUT

The fox jumps over the dog

DEMO

了解更多关于regexp_replace in the docs的信息


0
投票

对REGEXP_REPLACE使用'n'的“match param”选项告诉它让“匹配任何字符”字符(句点)包含换行符:

select regexp_replace('The ''quick 
brown'' fox jumps over the lazy dog', '''.*''', '', 1, 0, 'n')
from dual;

https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions137.htm#SQLRF06302

© www.soinside.com 2019 - 2024. All rights reserved.