ExcepOra
ExcepOra

Reputation: 117

How to with oracle regexp_replace parse string

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

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

don't work...

Upvotes: 0

Views: 114

Answers (1)

Kaushik Nayak
Kaushik Nayak

Reputation: 31676

Use REGEXP_SUBSTR with this pattern.

SELECT regexp_substr('ABC-30 (40D)', '^[^-]+-(\d+)[^0-9]+.*$' , 1 ,1 , 'i', 1  ) FROM DUAL;

Upvotes: 2

Related Questions