I have an input which I am binding to keyup()
On each keyup, I want it to:
- disallow any characters that are not a number, a letter, or a dash, and
- replace any uppercase characters with lowercase ones.
Regex makes my head explode, any help?
$('.my-input').keyup(function() {
this.value = this.value.replace(/[^0-9a-z-]/g,/[0-9a-z-]/g);
});
1 Answer