title: What is the equivalent of REGEXP_SUBSTR in mysql?
body: <p>I want to extract a word from a string column of a table.</p>
  
  <pre><code>description
  ===========================
  abc order_id: 2 xxxx yyy aa
  mmm order_id: 3 nn kk yw
  </code></pre>
  
  <p>Expected result set</p>
  
  <pre><code>order_id
  ===========================
  2
  3
  </code></pre>
  
  <p>Table will at most have 100 rows, text length is ~256 char and column always has one <code>order_id</code> present. So performance is not an issue.</p>
  
  <p>In Oracle, I can use <code>REGEXP_SUBSTR</code> for this problem. How would I solve this in MySQL?</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I am using LOCATE and SUBSTR to solve the problem. The code is ugly. Ten minutes after writing the code, I am cursing the guy who wrote such an ugly code. </p>
  
  <p>I didn't find the REGEXP_SUBSTR function in MySQL docs. But I am hoping that it exists..</p>
  
  <p>Answer to : Why cant the table be optimized? Why is the data stored in such a dumb fashion?</p>
  
  <p>The example I gave just denotes the problem I am trying to solve. In real scenario, I am using a DB based 3rd party queuing software for executing asynchronous tasks. The queue serializes the Ruby object as text. I have no control over the table structure OR the data format. The tasks in the queue can be recurring. In our test setup, some of the recurring tasks are failing because of stale data. I have to delete these tasks to prevent the error. Such errors are not common, hence I don't want to maintain a normalized shadow table.</p>