How can I validate the text that the user types in on keyup to detect wither or not the data is either a-z, A-Z, 0-9, or with these two characters -.

thank you.