title: Allow letters, digits and certain characters
body: <p>In a form a user can input some text. In the validation php I would like to check if this text includes only letters, numbers and the allowed special characters: <code>.,:;'"/*$@#&lt;&gt;&amp;+-</code></p>
  
  <pre><code>$pattern = '/^i';
  $chars = ".,:;'\"/*$@#&lt;&gt;&amp;+-";
  $newString = htmlspecialchars($chars);
  if (!preg_match($pattern, $chars, $text))   $error = $error . "You can use only letters, digits and [.,:;'\"/*$@#&lt;&gt;&amp;+-]".'&lt;br&gt;';
  </code></pre>
  
  <p>The <code>$error</code> variable is sent back to the page with the form and displayed there.</p>
  
  <p>Am I using the wrong pattern? No matter what I type in the input box I get the error.</p>