title: How to Use preg_match for New Line
body: <p>I prevent people from entering characters other than the one on preg_match with this code:</p>
  
  <pre><code>if (!preg_match("/^[a-zA-Z0-9 ]*$/",$input)) {
      $error = "Error";
  }
  </code></pre>
  
  <p><strong>It only permits:</strong></p>
  
  <ul>
  <li>A to Z</li>
  <li>0 to 9</li>
  <li>(space)</li>
  </ul>
  
  <p>But, if people click ENTER. data can not be sent. How do I have to change the code?</p>