title: PHP Regex Strip Away All Emojis
body: <p>I am trying to strip away all non-allowed characters from a string using regex. Here is my current php code</p>
  
  <pre><code>$input = "";
  
  $pattern = "[a-zA-Z0-9_ !@#$%^&amp;*();\\\/|&lt;&gt;\"'+\-.,:?=]";
  $message = preg_replace($pattern,"",$input);
  
  if (empty($message)) {
      echo "The string is empty";
  }
  else {
      echo $message;
  }
  </code></pre>
  
  <p>The emoji gets printed out when I run this when I want it to print out "The string is empty.".</p>
  
  <p>When I put my regex code into <a href="http://regexr.com/" rel="nofollow">http://regexr.com/</a> it shows that the emoji is not matching, but when I run the code it gets printed out. Any suggestions?</p>