title: Regex: Ignore Characters in String Comparison
body: <p><strong>I'm trying to find a regular expression to replace this idea:</strong></p>
  
  <pre><code>if($input === numbers_only($phone_number)) {
      // do something
  }
  </code></pre>
  
  <p><strong>Assumptions</strong></p>
  
  <p>$input will <em>always</em> be numeric</p>
  
  <p>numbers_only() strips all non-numeric characters</p>
  
  <p><strong>Context</strong></p>
  
  <p>At the end of the day I need to write a MySQL query that does this against a column formatted as TEXT which is why I can't simply use a function like the above.  So it'd look something like:</p>
  
  <pre><code>SELECT 
      number
  FROM
      phones
  WHERE
      number REGEXP '...'
  </code></pre>
  
  <p>Is this something regex can handle?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I think a better way to phrase this question (or another way to come at it) may be if there's a way the CONVERT() method in MySQL can handle converting TEXT (not varchar) to INT for a comparison.</p>