Assuming you mean alpha-numeric ... You'll want something like the following -- Obviously this is crude with no actual elements selected etc... And you'll want a function (keypress) or something wrapped around it.
var cleantext = /^[0-9a-zA-Z]+$/;
if(yourtextbox.value.match(cleantext))
{
return true;
}
For Just the characters above, a small function to check maybe?
var s = yourtextbox.value;
var charTest = (function() {
var cleanText = /^[<>#%{}|\\^~\[\]]$/i;
return function(s) {
return cleanText.test(s);
}
})();
Or even:
var s = yourtextbox.value;
function isClean(s) {
return ['"', '<', '>', '#', '%', '{', '}', '|', '\\', '^', '~', '[', ']', '`', '.'].indexOf(s) !== -1
}