1) ^[^\s].{1,20}$
2) ^[-/@#&$*\w\s]+$
3) ^([\w]{3})$
Are there any links for more information?
1) ^[^\s].{1,20}$
2) ^[-/@#&$*\w\s]+$
3) ^([\w]{3})$
Are there any links for more information?
1) match everything without space what have 1 to 20 chars.
2) match all this signs -/@#&$* plus words and spaces, at last one char must be
3) match three words
here is excelent source of regex
Matches any string that starts with a non-whitespace character that's followed by at least one and up to 20 other characters before the end of the string.
Matches any string that contains one or more "word" characters (letters etc), whitespace characters, or any of "-/@#&$*"
Matches a string with exactly 3 "word" characters
^[^\s].{1,20}$
Matches any non-white-space character followed by between 1 and 20 characters. [^\s]
could be replaced with \S
.
^[-/@#&$*\w\s]+$
Matches 1 or more occurances of any of these characters: -/@#&$*
, plus any word character (A-Ba-b0-9_
) plus any white-space character.
^([\w]{3})$
Matches three word characters (A-Ba-b0-9_
). This regular expression forms a group (with (...)
), which is quite pointless because the group will always equal the aggregate match. Note that the [...]
is redundant -- might as well just use \w
without wrapping it in a character class.
More info: "Regular Expression Basic Syntax Reference"