Let's take a look at the match usage in jquery.
String.match (Regular)
It looks the same as JS.
The regular rules for the phone number and the email we'll see.
Cell phone number Regular: ^ (((13[0-9]{1}) |159|153) +d{8})
Email address Regular: w+ (-w+) | (. w+)) *@[a-za-z0-9]+ ((. | -) [a-za-z0-9]+] *. [A-za-z0-9]
Now let's look at an example
The code is as follows
Copy Code
This article describes how to use the zf framework validator (user-defined validator and validator chain). For more information, see
The code is as follows:
Require_once ("Zend/Loader. php ");
// Introduce the validator class and the validator function class (Int), and the
Use of the ZF framework Validator [custom validator and validator chain]
Homework
Require_once ("Zend/Loader. php ");
// Introduce the validator class and the validator function class (Int), and the custom interface class;
Zend_Loader: loa
This article describes how to use the zf framework validator (User-Defined validator and validator chain). For more information, see
The Code is as follows:
Require_once ("Zend/Loader. php ");// Introduce the validator class and the validator function class (Int), and th
Copy codeThe Code is as follows:Require_once ("Zend/Loader. php ");// Introduce the validator class and the validator function class (Int), and the custom interface class;Zend_Loader: loadClass ('zend _ validate ');Zend_Loader: loadClass ('zend _ Validate_Int ');Zend_Loader: loadClass ('zend _ Validate_Interface ');// Added the UDF class GongBeiNum [Public multiple]Class GongBeiNum implements Zend_Validate_
address;
9. Web sites using the HTTP protocol;
10. Telephone number;
11. Currency;
12. mobile phone number;
13. zip Code;
14. Identification number (1.05 enhancement);
15.QQ number;
16. Date;
17. The password which complies with the safety rule;
18. Duplicate value of a certain item;
19. Comparison of the relationship between two numbers;
20. Determine whether the input value is in (n, m) interval;
21. Enter character length limits (can be compared b
Preface
Ease of use is the goal of the. NET validator verification framework. Based on the attribute validators identification and rich verification return types, it provides scalable validators interface... -- another wish and idea start, happy ing :)
Body
I,Framework Introduction
This framework matches the property name, the key in form and querystring, And the ID of the server-side control based on the attribute
This example describes the Yii2 validator (Validator) usage. Share to everyone for your reference, as follows:
Let's take a look at the validator's use.
Public Function Rules () { return [[ ' email ', ' password '], ' required '], [' Password ', ' string ', ' min ' =>6 ], ];}
As shown above, the validator is primarily used in the rules, validating the va
The example in this article describes the Yii2 Validator (Validator) usage. Share to everyone for your reference, specific as follows:
First look at the use of the validator.
Public Function rules () {return [[
' email ', ' password '], ' required '],
[' Password ', ' string ', ' min ' = >6],
];
}
As shown above, the
Implementation Code of the vue + vue-validator form verification function, vuevue-validator
Official documents: http://vuejs.github.io/vue-validator/zh-cn/index.html
Github address: https://github.com/vuejs/vue-validator
The following describes the vue + vue-validator form v
Hibernate Validator Useimport Validation-api-xxx.jar and hibernate-validator-xxx. Final.jarJava Bean Entity.java to checkImport Javax.validation.constraints.max;import Org.hibernate.validator.constraints.length;public class Entity {@Max (value=3)//maximum value is 3private int age; @Length (max=1)///String length maximum is 1,hibernate extended private string name;public int getage () {return Age;} public v
In the background development process, the validation of parameters becomes an indispensable part of the development environment. For example, the parameter can not be null,email so must conform to the format of email, if manually make if judgment or write regular expression to judge the unintended development efficiency is too slow, in time, cost, quality of the game will inevitably lag behind. So the verification layer is the inevitable result of abstraction, the following is a few solutions.T
Copy Code code as follows:
Require_once ("zend/loader.php");
The introduction of the validator class and the function Class (INT) of the calibrator, and the custom interface class;
Zend_loader::loadclass (' zend_validate ');
Zend_loader::loadclass (' Zend_validate_int ');
Zend_loader::loadclass (' Zend_validate_interface ');
Add custom Validator Feature Class (gongbeinum) [Common multiple]
Class
This article mainly introduces how to judge the results of the validator. Here, let's look at how to implement a custom validator.
Goal
We want to implement a verification of the phone number of the validator, the use of the example or based on the previous article inside the example, that is, the user information en
"
}
Input::all () passes all parameters in for validationRule stipulates that the email field can not be empty, it must conform to the format of the email. Rule stipulates that the email field can not be empty, it must conform to the format of the email. The message indicates that if the required rule is violated, the format for displaying the error is: ": attribute cannot be empty"$attributes indicate that the error shown in email appears as text "e-mail"
The above settings add up to ca
validator as follows:
@ Before (loginvalidator. class) Public void login () {string username = getpara ("name"); string Password = getpara ("password"); If ("admin ". equals (username) "admin ". equals (password) {rendertext ("Logon successful") ;}else {rendertext ("Logon Failed ");}}
When you log on, submit this method. First, go to the validator to verify that the submitted field is valid. If it is i
Use the rich built-in verification methods provided by validator to simplify struts development.A major benefit of the Struts framework is that it provides a built-in interface for verifying received form data. If any verification fails, the application will re-display the HTML form to correct invalid data. If the verification is successful, the process continues. The simple validation interface of the Struts framework reduces the headaches related to
Verification Framework-based input verification
1. Create a struts2 project testValidators. Struts2 Initial Experience: http://www.cnblogs.com/likailan/p/3280820.html
Registration page, register. jsp:
Use
Use the
Registered Email: Password: Repeated password: Phone:
Registered successfully
The fields to be verified must provide the corresponding fields and the corresponding get and set methods in the class.
RegisterAction
Use the rich built-in verification methods provided by validator to simplify struts development.
A major benefit of the Struts framework is that it provides a built-in interface for verifying received form data. If any verification fails, the applicationProgramThe HTML form is re-displayed, so that invalid data can be corrected. If the verification is successful, the process continues. The simple validation interface of the Struts framework reduces
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.