Skip to content
Advertisement

How to extract text between two words in Oracle

This is the source string:

In Oracle query, how do I extract Jack Ryan from it?

I guess I am looking for whatever is between "name" : " and ",

Advertisement

Answer

One option is regexp_replace():

You can also use regexp_substr():

This captures the portion of the string within double quotes that follows string '"name" : '.

Demo on DB Fiddle:

COL                                                    | NEWCOL1   | NEWCOL2  
:----------------------------------------------------- | :-------- | :--------
random foobar "name" : "Jack Ryan", other random stuff | Jack Ryan | Jack Ryan
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement