User User - 1 year ago 90
Javascript Question

RegEx for Javascript to allow only alphanumeric

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 want one what would allow either and not require both.

Answer Source

^         start of string
[a-z0-9]  a or b or c or ... z or 0 or 1 or ... 9
+         one or more times (change to * to allow empty string
$         end of string

/i        case-insensitive
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download