Reputation: 1495
I'm suresomeone of you know how to do this easily, I am trying to validate my inputs that only allows numbers, characters and/or an empty space which mean nothing in a string ""
, so I have /^[0-9a-zA-Z]+$/
only missing that empty space in there. Seems I can't find the express for it, so I tried to create a variabel var emptyStr = ""
and put it in there but don't really know how to write the correct syntax.
Upvotes: 0
Views: 177
Reputation: 2401
Use *
rather than +
. *
is 0 or more times. +
is 1 or more times.
/^[0-9a-zA-Z]*$/
Upvotes: 2