Reputation: 1907
ORACLE:SQL REGEXP_SUBSTR that returns the column value after last backslash(/)
example: https://test/test/test/test/getTest/1234 expected value: 1234
Upvotes: 0
Views: 612
Reputation: 39507
You don't need regular expressions for this. You can simply using substr
and instr
which are likely to perform faster:
select
substr(col, instr(col, '/', -1) + 1)
from t;
If you must use regexp_substr
(for some reason) then use:
select regexp_substr(col, '[^/]+$') from t;
Upvotes: 1
Reputation: 42783
If you need with REGEXP_SUBSTR also, then:
SELECT REGEXP_SUBSTR ('https://test/test/test/test/getTest/1234' , '[^/]+$' ) from dual
Upvotes: 0