title: Retrieving certain strings within a string using Oracle SQL
body: <p>I am trying the following string search using Oracle SQL 11g R2:</p>
  
  <p>Data is:</p>
  
  <blockquote>
    <p>| CN=aXYZApple-Au,OU=Managed,OU=Groups,DC=core,DC=dir,DC=abc,DC=com |
    CN=31107427,OU=Distribution Lists,OU=Shared
    Mailboxes,DC=core,DC=dir,DC=abc,DC=com |
    CN=ea90045052,OU=Groups,OU=eProfile,DC=core,DC=dir,DC=abc,DC=com |
    CN=S0901448,OU=Distribution Lists,OU=Shared
    Mailboxes,DC=core,DC=dir,DC=abc,DC=com | CN=00900887,OU=Distribution
    Lists,OU=Shared Mailboxes,DC=core,DC=dir,DC=abc,DC=com |
    CN=NSMMMM,OU=LRP,OU=Groups,DC=core,DC=dir,DC=abc,DC=com |
    CN=aXYZApple-Readonly,OU=Managed,OU=Groups,DC=core,DC=dir,DC=abc,DC=com
    | CN=WWSWW-Au,OU=LRP,OU=Groups,DC=core,DC=dir,DC=abc,DC=com |
    CN=aLogical_RW,OU=Managed,OU=Groups,DC=core,DC=dir,DC=abc,DC=com |
    CN=aXYZApple-Write,OU=Managed,OU=Groups,DC=core,DC=dir,DC=abc,DC=com |</p>
  </blockquote>
  
  <p>From the above data, I need to obtain all strings that hold the string "aXYZApple" only with the "OU=Managed" as the second part of this string match.</p>
  
  <p>So based on the above, the following results is what I am after and would be displayed only:</p>
  
  <pre><code>aXYZApple-Au
  aXYZApple-Readonly
  aXYZApple-Write
  </code></pre>
  
  <p>Am using Oracle regexp_like/regexp_replace.</p>