title: Remove control characters from string in PHP
body: <p>I have a lot of strings in our MySQL database that have control characters such as <code>^M</code>. I want a regex that removes it in PHP, but leaves alone things such as new lines, eg: "\n". </p>
  
  <p>I've tried the following:</p>
  
  <p><code>preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', '', $bad);</code></p>
  
  <p>This seems to leave it in place. </p>
  
  <p>What's the best way to get rid of these control characters?</p>