title: Trying to remove everything but numbers, but regexes don't seem to work
body: <p>I'm trying to remove everything but numbers from a variable in PHP. I tried with regexes, and a quick Google turns up all kinds of people telling me to use regexes too, but no regex seems to work. I'm using <code>preg_replace('/\D/', '', $amount);</code>. I tried all kinds of different regexes, most notably <code>/\D/</code>, <code>/[\D]/</code>, <code>/^\d/</code>, <code>/[^\d]/</code>, and <code>/[^0-9]/</code>, but none of them work.</p>
  
  <p><strong>Edit:</strong> I found why it didn't work! I was under the impression that <code>preg_replace('/\D/', '', $amount);</code> would <em>replace</em> $amount, but I now see that I have to <code>$new_amount = preg_replace('/\D/', '', $amount);</code> and use $new_amount. Stupid, I know. Thanks anyway!</p>