0

I have data in an Oracle column in the below format:

Ch99// 4// Sub// 586915 16// jkc 12/12/22

And I need to extract the substring of "4" that will always be between the first two occurrences of "//".

So the output needed is:

4

I'm currently using ,regexp_substr(column, '//([^}]+)//', 1,1,NULL,1) but it's returning everything after the first "//"

1 Answer 1

1

I think the simplest thing is probably to use '//(.*?)//'. This matches any characters between // and //, but does it in a non-greedy way.

It is not clear why you are trying to use [^}]+ (matches one or more characters that are not a closing curly brace), since your question doesn't mention any requirements around curly braces.

A Fiddle of it working with your example:

SELECT regexp_substr(
 'Ch99// 4// Sub// 586915 16// jkc 12/12/22',
 '//(.*?)//', 
 1, 1, null, 1)
FROM dual

returns

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

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.