title: capture the starting characters with many patterns
body: <p>I need to capture the starting characters from database objects with various pattern search.</p>
  <p>I have tried using the REGEX expression ,below query i am trying and the expected data set to be.</p>
  <p><strong>Query 1</strong></p>
  <pre><code>SELECT
     owner AS schema_name, 
     object_name,        
     object_type,
     REGEXP_REPLACE(OBJECT_NAME, '^([A-Z0-9$]{1,})_.*', '\1') as BEGINNING,
     count(*),
     round(100*ratio_to_report(count(*)) over (), 4) percentage 
  FROM
     dba_objects 
  GROUP BY
     owner,
     object_name,
     object_type,
     REGEXP_REPLACE(OBJECT_NAME, '^([A-Z0-9$]{1,})_.*', '\1') 
  ORDER BY
     percentage desc; 
  </code></pre>
  <p><em><strong>Expected Data Set</strong></em></p>
  <pre><code>OBJECT_NAME                     BEGINNING  COUNT(*) PERCENT
  ABC_CUST_INFO_D                 ABC        20      .00010
  BBC_CUST_ENTRY_F                BBC        100     .030
  FHS_PRDCT_STST_T                A$f        194     .031
  GHS_INVTR_CD_DRY                A1B        493     .051
  #Tableau_6_sid:15251a_4i_2a     #Tableau   4000    1.5
  /15722c29d_PhotoImageCameraPro  /15722c29d 5000    1.6
  JAVA/15722c29d_PhotoImageqeeee  JAVA 5000  1.6
  </code></pre>
  <p>Unfortunately i was not able to separate the below</p>
  <p>#Tableau_6_sid:15251a_4i_2a       --&gt;   <strong>#Tableau</strong></p>
  <p>/15722c29d_PhotoImageCameraPro    --&gt;   <strong>/15722c29d</strong></p>
  <p>JAVA/15722c29d_PhotoImageqeeee    --&gt;   <strong>JAVA</strong></p>
  <p>how to resolve ?</p>
  <p>so how to capture the last character after _ , below is an example</p>
  <p><strong>Query 2 - capture the last characters</strong></p>
  <pre><code> select 
     owner, 
     object_name, 
     object_type, 
     regexp_substr(object_name, '[^_]*$') ENDING, 
     count(*) COUNT, 
     round(100*ratio_to_report(count(*)) over (), 4) percentage  
  from 
     dba_objects  
     where object_name like '%/%'
  group by 
     owner, 
     object_name, 
     object_type, 
     regexp_substr(object_name, '[^_]*$') 
     ORDER BY 
     percentage desc
  </code></pre>
  <p><em><strong>Expected Data Set</strong></em></p>
  <pre><code>OBJECT_NAME                     BEGINNING       COUNT(*) PERCENT
  ABC_CUST_INFO_D                 D               20      .00010
  BBC_CUST_ENTRY_F                F               100     .030
  FHS_PRDCT_STST_T                T               194     .031
  GHS_INVTR_CD_DRY                DRY             493     .051
  Teradata/jdbc/EXAcore/MPPReader MPPReader       5000    1.6
  sqlj/modegen/engine/FuncInit    FuncInit        8000    6.0
  moon/aio/af/ext/ISCII11$Decoder ISCII11$Decoder 8700    6.1
  </code></pre>
  <p>Unfortunately i was not able to separate the below</p>
  <p>Teradata/jdbc/EXAcore/MPPReader  --&gt;   <strong>MPPReader</strong></p>
  <p>sqlj/modegen/engine/FuncInit    --&gt;   <strong>FuncInit</strong></p>
  <p>moon/aio/af/ext/ISCII11$Decoder --&gt;  <strong>ISCII11$Decoder</strong></p>