Evaluate a regular expression for verifying the user name
Ladies and gentlemen, the younger generation asked for a regular expression to verify the user name. After a week of hard work, I still did not get it out. I am dull. I hope you can advise me!
VBscript programming requires that the user name should contain 3 to 20 characters, which may consist of Chinese characters, uppercase/lowercase letters, numbers, underscores, decimal points, and minus signs, the combination must start with a Chinese character or number and end with an underscore, decimal point, or minus sign. The combination cannot be consecutive a _ a or a -- a or .. a is like this, but it can be like a_a.a_a.a_a-a-a-a_a-a.a.a.a.
If this parameter is exceeded, the user name fails.
The combination of the underline, decimal point, and minus sign is too big.
This is a non-conforming regular expression:
^. {0, 2 }$ |. {21,} | ^ [^ A-Za-z0-9 \ u4E00-\ u9FA5] | [^ \ w \ u4E00-\ u9FA5. -] | ([_. -]) \ 1
<Input id = strs value = "a_a.a_a.a_a-a-a_a-a" size = 40> <input type = button onclick = regtest (strs. value) value = "check">
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
(?! Pattern)
Negative pre-query: match the search string at the start of any string that does not match Negative lookahead matches the search string at any point where a string not matching pattern. This is a non-get match, that is, the match does not need to be obtained for future use. For example, 'windows (?! 95 | 98 | NT | 2000) 'can match "Windows" in "Windows 3.1", but cannot match "Windows" in "Windows 2000 ". Pre-query does not consume characters. That is to say, after a match occurs, the next matching search starts immediately after the last match, instead of starting after the pre-query characters.