title: Regex to catch ANY non-letter, non-number, non-space
body: <p>I am trying to allow ONLY letters numbers and spaces.</p>
  
  <p>no _  . ! ~ `</p>
  
  <p>and any other special character (i know that _ is supposed to be letter.. i just dont want it)</p>
  
  <p>my question is: how should i write it?</p>
  
  <p>mostly ive found answeres that specified the characters that are "illegal" like:</p>
  
  <pre><code>^[^$&amp;+,:;=?@}{#|'\\&lt;&gt;\/.^*()%!\]\[~`_-]+[^$&amp;+,:;=?@}{#|'\\&lt;&gt;\/.^*()%!\]\[~`_-]*$
  </code></pre>
  
  <p>but i was wondering if theres a better way to do it like :</p>
  
  <pre><code>^[a-zA-Z0-9\s]+[a-zA-z0-9\s]*$
  </code></pre>
  
  <p>the problem with this  one is that if the characters  <code>[]^``_\</code> are after letter/number/space its still passes thru</p>
  
  <pre><code>[]`\^_    &lt;&lt;this will be illegal
  1[]`\^_    &lt;&lt;this will not be caught as illegal
  </code></pre>
  
  <p>I also tried:<code>^[\w\d\s]+[\w\d\s]*$</code></p>
  
  <p>but it lets _  go thru </p>
  
  <p>edit
  i had a typo in the second code (A-z) so changed it to</p>
  
  <pre><code>^[a-zA-Z0-9\s]+[a-zA-Z0-9\s]*$
  </code></pre>
  
  <p>and it works perfectly</p>
  
  <p>so is it better to write like this instead of typing everysingle special chatacter (like the first code)?
  are there possible characters that could slip by this check?</p>