I need to find a reg ex that only allows alphanumeric. So far, everyone I try only works if the string is alphanumeric, meaning contains both a letter and a number. I just w
Use the word character class. The following is equivalent to a ^[a-zA-Z0-9_]+$:
^[a-zA-Z0-9_]+$
^\w+$
Explanation:
Use /[^\w]|_/g if you don't want to match the underscore.
/[^\w]|_/g