REGEXP_SUBSTR-Oracle

REGEXP_SUBSTR-Oracle,regex,oracle,substr,Regex,Oracle,Substr,如何使用REGEXP_SUBSTR(使用oracle sql)从下面获取第四个正斜杠后的所有单词 /plt/v1/v2/装运经理/电网/船厂 我只需要 货运经理/电网/船务部 谢谢假设列名为col1: select substr(col1, instr(col1, '/', 1, 4) + 1) from ... 您不需要regexp;只要可以使用标准substr和instr,就更好了,因为regexp速度较慢。使用regexp\u REPLACE: REGEXP_REPLACE( your_

如何使用REGEXP_SUBSTR(使用oracle sql)从下面获取第四个正斜杠后的所有单词

/plt/v1/v2/装运经理/电网/船厂

我只需要

货运经理/电网/船务部


谢谢

假设列名为col1:

select substr(col1, instr(col1, '/', 1, 4) + 1)
from ...

您不需要regexp;只要可以使用标准substr和instr,就更好了,因为regexp速度较慢。

使用
regexp\u REPLACE

REGEXP_REPLACE( your_column, '^(/.*?){3}/' )
使用
REGEXP\u SUBSTR

REGEXP_SUBSTR( your_column, '^(/.*?){3}/(.*)$', 1, 1, NULL, 2 )
SUBSTR( your_column, INSTR( your_column, '/', 1, 4 ) + 1 )
或者使用
INSTR
SUBSTR

REGEXP_SUBSTR( your_column, '^(/.*?){3}/(.*)$', 1, 1, NULL, 2 )
SUBSTR( your_column, INSTR( your_column, '/', 1, 4 ) + 1 )

谢谢你的回复@MT0-在你的上一个解决方案中,你必须重复你的_列作为INSTR的第一个参数,对吗?@mathguy谢谢,这就是我在赶飞机时写的东西。