title: PHP regular expression to match alpha-numeric strings with some (but not all) punctuation
body: <p>I've written a regular expression in PHP to allow strings that are alpha-numeric with any punctuation except <strong>&amp;</strong> or <strong>@</strong>. Essentially, I need to allow anything on a standard American keyboard with the exception of those two characters. It took me a while to come up with the following regex, which seems to be doing what I need:</p>
  
  <pre><code>if (ereg("[^]A-Za-z0-9\[!\"#$%'()*+,./:;&lt;=&gt;?^_`{|}~\-]", $test_string)) {
    // error message goes here
  }
  </code></pre>
  
  <p>Which brings me to my question... is there a better, simpler, or more efficient way?</p>