0

ORACLE:SQL REGEXP_SUBSTR that returns the column value after last backslash(/)

example: https://test/test/test/test/getTest/1234 expected value: 1234

2 Answers 2

1

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;

Demo

If you must use regexp_substr (for some reason) then use:

select regexp_substr(col, '[^/]+$') from t;

Demo

Sign up to request clarification or add additional context in comments.

Comments

0

If you need with REGEXP_SUBSTR also, then:

SELECT REGEXP_SUBSTR ('https://test/test/test/test/getTest/1234' , '[^/]+$' )  from dual

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.