title: preg_replace in PHP - regular expression for NOT condition
body: <p>I am trying to write a function in PHP using preg_replace where it will replace all those characters which are NOT found in list. Normally we replace where they are found but this one is different.</p>
  
  <p>For example if I have the string:</p>
  
  <pre><code>$mystring = "ab2c4d";
  </code></pre>
  
  <p>I can write the following function which will replace all numbers with *:</p>
  
  <pre><code>preg_replace("/(\d+)/","*",$mystring);
  </code></pre>
  
  <p>But I want to replace those characters which are neither number nor alphabets from a to z. They could be anything like #$*();~!{}[]|\/.,&lt;>?' e.t.c.</p>
  
  <p>So anything other than numbers and alphabets should be replaced by something else. How do I do that?</p>
  
  <p>Thanks</p>