A regular expression used to verify the user name

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.