Allow only certain character in input field
<p><a href="http://jsbin.com/cunejafehe/edit?html,js,console,output" rel="nofollow">http://jsbin.com/cunejafehe/edit?html,js,console,output</a></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var reg = /^[a-zA-Z\d\s\-'#(),"]*$/;
   
function myFunction(e){
  console.log(e.value);
  if(reg.test(e.value))
   {
     return false;
   }
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input onkeyup="myFunction(this)" type="text"&gt;</code></pre>
</div>
</div>
</p>

<p>I wonder why above code doesn't work, what I want to do is allow only these character to be in the input : <code>a-z</code> and <code>1-9</code> including <code>0</code>, and these character <code>-'#(),"</code></p>