我想修剪给定字符串的值,直到oracle pl / sql中的指定字符串。 有些事情如下。
OyeBuddy $$柔性Flex_Image_Rotator-1443680885520。
在上面的字符串中我想修剪到$$以便我得到" flex-Flex_Image_Rotator-1443680885520"。
答案 0 :(得分:2)
你可以用不同的方式;这里有两种方法,有和没有正则表达式:
with test(string) as ( select 'OyeBuddy$$flex-Flex_Image_Rotator-1443680885520.' from dual)
select regexp_replace(string, '(.*)(\$\$)(.*)', '\3')
from test
union all
select substr(string, instr(string, '$$') + length('$$'))
from test
答案 1 :(得分:0)
你想做一个SUBSTR
,其中起始位置将是'$$' + 2
的位置。 +2
是因为字符串'$$'
的长度为2,我们不希望在结果中包含该字符串。
像 -
SELECT SUBSTR (
'ABCDEF$$some_big_text',
INSTR ('ABCDEF$$some_big_text', '$$') + 2)
FROM DUAL;