Oracle Regex to extract substring between two patterns

I have a column where I need to extract a string that sits between two patterns.  The string is as follows:

A<1,?,'providerInfo'='0003\\370\\3370288.dat','storageProviderName'='ExtShared','subProviderName'='Default'>

Open in new window


And I need to extract the embedded file path

0003\\370\\3370288.dat

Open in new window


Bonus points if you can also replace the \\ with \
bmsandeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
I went the extra mile and looked for the delimiter providerInfo

If you have 11gR2 or above try this:
with mydata as(
select q'[A<1,?,'providerInfo'='0003\\370\\3370288.dat','storageProviderName'='ExtShared','subProviderName'='Default'>]' mycol from dual
)
select replace(regexp_substr(mycol,'(providerInfo''=''([^'']+))',1,1,null,2),'\\','\') from mydata
/

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slightwv (䄆 Netminder) Commented:
If you don't care about the delimiter and only want that specific pattern then try this:
with mydata as(
select q'[A<1,?,'providerInfo'='0003\\370\\3370288.dat','storageProviderName'='ExtShared','subProviderName'='Default'>]' mycol from dual
)
select replace(regexp_substr(mycol,'[0-9\]+\.[a-z]{3}'),'\\','\') from mydata
/

Open in new window

sdstuberCommented:
SELECT REPLACE(
           REGEXP_SUBSTR(
               yourstring,
               q'['providerInfo'='(.*)','storageProviderName]',
               1,
               1,
               NULL,
               1
           ),
           '\\',
           '\'
       )
  FROM (SELECT q'[A<1,?,'providerInfo'='0003\\370\\3370288.dat','storageProviderName'='ExtShared','subProviderName'='Default'>]'
                   yourstring
          FROM DUAL)
bmsandeAuthor Commented:
Worked beautifully.  I award you 1 trillion bonus points.
slightwv (䄆 Netminder) Commented:
Glad to help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.