title: Return a specific capture group/substring in MySQL 5 using REGEXP
body: <p>I'm having trouble writing the regular expression to do what I need in MySQL syntax.</p>
  
  <p>I have the following value for column <code>http_referer</code> in a database table:</p>
  
  <pre><code>https://www.example.com?id=123&amp;true
  </code></pre>
  
  <p>And I need to return the value of the query string parameter <code>uid</code> (in this case, <code>123</code>), to plug in to another query.</p>
  
  <pre><code>`SELECT * FROM sites WHERE id = (http_referer REGEXP 'uid=([0-9]+)&amp;?')
  </code></pre>
  
  <p>This is my query, that doesn't work, probably because I'm trying to pass in a PHP-style regular expression instead of one MySQL can use (however, I understand that MySQL doesn't even support capture groups, so I'm kind of stumped).</p>