title: Regex in oracle
body: <p>How to get these data I want in <strong>Oracle, using REGEXP_SUBSTR</strong></p>
  
  <pre><code>SPRINTMVNO_PM_CDR_IWIRELESS_20121110_0813.csv get '08'in last four digits
  RK_IPDR_RKMSG2_0043722_DT_20121113162710.txt  get '0043722' in the middle(between'_')
  wireless_201211120015_201211120515            get '0515' (last four digits)
  </code></pre>
  
  <p>I have tried many times, but some expression works fine in PHP or other language but not work in ORACLE. Maybe the syntax is different. </p>
  
  <p>For example : the second one I can use  <code>/(?&lt;=_)[0-9]*(?=_)/</code> to get the number in php, but this does not work in Oracle.<br>
  I tried</p>
  
  <pre><code>SELECT REGEXP_SUBSTR('RK_IPDR_RKMSG2_0043722_DT_20121113162710.txt','(?&lt;=_)[0-9]*(?=_)') 
    FROM dual;
  </code></pre>
  
  <p>No output. So it's not the problem of the two slash lines</p>
  
  <p>An alternate formulation of this question would be "how to get content between or start with a character but <strong>not include</strong> it, with Oracle's regex ? "</p>
  
  <p>I know I can get those data easily by using string functions, the problem is there are tons of different strings to handle, each of them have different data to retrieve. So I want to store the patterns into database, and use one regexp_substr to get all data. Otherwise I need to hard code those rules.</p>