Formvalidtor's regular expression writing in thinkphp
Source: Internet
Author: User
Formvalidtor in thinkphp regular expression writing problems-help this post was last edited by wadelin511 in 2013-03-1312: 25: 31 using formValidator-4.1.3.js for email format check. The writing method is as follows. & Nbsp; & nbs formvalidtor in thinkphp
This post was last edited by wadelin511 at 12:25:31
Use the formValidator-4.1.3.js for email format check.
The writing method is as follows.
$ ("# Email "). formValidator ({onShow: "Please enter your email address", onFocus: "mailbox 6-characters, enter the correct information to exit the focus", onCorrect: "Congratulations, you have entered the correct information", defaultValue: "@"}). inputValidator ({min: 6, max: 100, onError: "The email you entered is invalid. please confirm "}). regexValidator ({regExp: "^ ([\ w-.] +) @ ([0-9] {1, 3 }. [0-9] {1, 3 }. [0-9] {1, 3 }.) | ([\ w-] + .) +) ([a-zA-Z] {2, 4} | [0-9] {1, 3}) (]?) $ ", OnError:" The email format you entered is incorrect "});
The test is normal on the static webpage. However, in the thinkphp template file, the parsed code becomes
RegExp: "^ ([\ w-.] +) @ ([0-9] {1, 3 }. [0-9] {1, 3 }. [0-9] {1, 3 }.) | ([\ w-] + .) +) ([a-zA-Z] {2, 4} | [0-9] {1, 3}) (]?) $"
The formValidator message "the operator set is out of bounds" is reported.
Why is the expression changed. \ W changed to \ w?
Please help confirm it!
Thinkphp formvalidtor character set out of bounds
------ Solution --------------------
The template file will be read into the variable, so \ w becomes \ w
Write \ w or \ w
------ Solution --------------------
This is not clear. you need to check the C source code of php to analyze the cause.
But not everyone can do this.
In actual use, you do not need to go into it. if you add a "\" when it is not running, you need to add another one, so that the loop knows that there is no error.
You can see that there are four or five lines of code in foreign countries.
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.