http://jsbin.com/cunejafehe/edit?html,js,console,output
var reg = /^[a-zA-Z\d\s\-'#(),"]*$/;
function myFunction(e){
console.log(e.value);
if(reg.test(e.value))
{
return false;
}
}
<input onkeyup="myFunction(this)" type="text">
I wonder why above code doesn't work, what I want to do is allow only these character to be in the input : a-z
and 1-9
including 0
, and these character -'#(),"