I have a user created string. I am only allowing the characters A-Z, a-z, 0-9, -, and _
Using JavaScript, how can I test to see if the string contains characters that are NOT these? If the string contains characters that are not these, I want to alert the user that it is not allowed.
What Javascript methods and RegEx patterns can I use to match this?