Hi Guys,
I am using C# and jQuery to valid a username with Regex. Just learning :) So far I have
UserName = "[a-zA-Z0-9]";
But this doesn't stop symbols ? How to ensure that no symbols or " . " or " _ " ?
Thanks
From stackoverflow
-
That regex says "At least one letter or number" you want "Every character from the start to the end is a letter or number"
"^[a-zA-Z0-9]+$"
Murray : oh great thanks :) wow fast reply! ill try this. thanks so muchMurray : great! thanks again :))))Péter Török : As an addition, typically usernames are not allowed to start with digits - to ensure this, use `"^[a-zA-Z][a-zA-Z0-9]*$"`.Amarghosh : And if you want min/max length restrictions: `"^[a-zA-Z][a-zA-Z0-9]{3,9}$"` (min 4 and max 10)Murray : so this works ? ^[a-zA-Z0-9]{3,11}$ - for no symbols, min/max 3-11 ?Alan Moore : @Gabriel: check that again; Murray removed the separate letter in the front.
0 comments:
Post a Comment