The input format needs to be verified in many places on the front-end. In order to facilitate future use, put the commonly used sorting here for future use. They are all tested and can be used with ease. I tried only two of them because I had something to do today. So here we should first put two. After the test is complete, we will add them up. Haha .... SyntaxHighlighter. all ();
The input format needs to be verified in many places on the front-end. In order to facilitate future use, put the commonly used sorting here for future use. They are all tested and can be used with ease. I tried only two of them because I had something to do today. So here we should first put two. After the test is complete, we will add them up. Haha. By the way, if you find a problem, we hope to raise it and make common progress.
Js Code
/**
Authentication username, which must consist of letters, numbers, and underscores (_), with 6 to 20 characters
*/
Function validateName (name ){
Var reg =/^ [\ w _] {6, 20} $ /;
If (reg. test (name )){
Return true;
}
Return false;
}
/**
Verify email
*/
Function validateEmail (email ){
Var reg =/^ [\ w _ \.] + @ [\ w] + \. [\ w] + $ /;
If (reg. test (email )){
Return true;
}
Return false;
}
I hope you can correct it.
This article is from "Junior programmers"