Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ORACLE:SQL REGEXP_SUBSTR 返回最后一个反斜杠 (/) 之后的列值
示例: https://test/test/test/test/getTest/1234 预期值:1234
您不需要正则表达式。您可以简单地使用substr并且instr可能执行得更快:
substr
instr
select substr(col, instr(col, '/', -1) + 1) from t;
如果您必须使用regexp_substr(出于某种原因),请使用:
regexp_substr
select regexp_substr(col, '[^/]+$') from t;
如果您还需要 REGEXP_SUBSTR,那么:
SELECT REGEXP_SUBSTR ('https://test/test/test/test/getTest/1234' , '[^/]+$' ) from dual