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
Even better than Gayan Dissanayake pointed out.
Gayan Dissanayake
/^[-\w\s]+$/
Now ^[a-zA-Z0-9]+$ can be represented as ^\w+$
^[a-zA-Z0-9]+$
^\w+$
You may want to use \s instead of space. Note that \s takes care of whitespace and not only one space character.