If you want to register a regular expression match, or if there is a "..." before it, you cannot register it.

Source: Internet
Author: User
If you want to register a regular expression match, or if there is a "..." before it, you cannot register it.
Username: "^ \ w + $", // used for user registration. Match the string username1 consisting of digits, 26 English letters, or underscores: "^ (\ w +) | ([\ u4E00-\ u9FA5 \ uF900-\ uFA2D] +) $ ", // used for user registration, supports Chinese characters


If you want to register a regular expression match, or if there is a "..." before it, you cannot register it.


Reply to discussion (solution)

So you can provide a regular expression that can meet the registration requirements?

$p='/^\.\.|\.\.$/';

Regular expressions are not required. Regular expressions are not required if string functions are used.

$ Str = "... zh... ddjjdd ..";
$ User_left = substr ($ str, 0, 2 );
$ User_right = substr ($ str,-2 );
If ($ user_left = '..' & $ user_right = '..'){
Echo "invalid user name ";
} Else {
Echo "legal user ";
}
In this way, you can

Regular expressions are not required. Regular expressions are not required if string functions are used.

$ Str = "... zh... ddjjdd ..";
$ User_left = substr ($ str, 0, 2 );
$ User_right = substr ($ str,-2 );
If ($ user_left = '..' & $ user_right = '..'){
Echo "invalid user name ";
} Else {
Echo "legal user ";
}
In this way, "..." can be followed or in front of it & should be changed to |, or


Regular expressions are not required. Regular expressions are not required if string functions are used.

$ Str = "... zh... ddjjdd ..";
$ User_left = substr ($ str, 0, 2 );
$ User_right = substr ($ str,-2 );
If ($ user_left = '..' & $ user_right = '..'){
Echo "invalid user name ";
} Else {
Echo "legal user ";
}
In this way, "..." can be followed or in front of it & should be changed to |, or
Sorry, you are careless when writing examples. either or | yes.

According to his writing requirements, it seems that English numbers, underscores, common Chinese characters, and some full-angle symbols are allowed.

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.