title: MySQL strip non-numeric characters to compare
body: <p>I'm looking to find records in a table that match a specific number that the user enters.  So, the user may enter 12345, but this could be 123zz4-5 in the database.</p>
  <p>I imagine something like this would work, if PHP functions worked in MySQL.</p>
  <pre><code>SELECT * FROM foo WHERE preg_replace(&quot;/[^0-9]/&quot;,&quot;&quot;,bar) = '12345'
  </code></pre>
  <p>What's the equivalent function or way to do this with just MySQL?</p>
  <p><em>Speed is not important.</em></p>