0

I have a string: "ABC-30 (40D)", the result is 30, my example:

regexp_replace(f, '^[^-]+-(\d+)*')

don't work...

1
  • without regexp it works, but I'm afraid this :D substr(substr(f, - instr(reverse(f), '-') + 1), 1, instr(substr(f, - instr(reverse(f), '-') + 1), ' ')-1), Commented Oct 7, 2017 at 11:34

1 Answer 1

2

Use REGEXP_SUBSTR with this pattern.

SELECT regexp_substr('ABC-30 (40D)', '^[^-]+-(\d+)[^0-9]+.*$' , 1 ,1 , 'i', 1  ) FROM DUAL;
Sign up to request clarification or add additional context in comments.

2 Comments

Ok, thx, pls advise, how to with regexp_like in where clause filter only digits in this example result is same: 30?
REGEXP_LIKE(f, '^[^-]+-(\d+)[^0-9]+.*$') this is work

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.