Formvalidtor of the regular expressions in thinkphp--help

Source: Internet
Author: User
Formvalidtor of the regular expression in thinkphp--help
This post was last edited by wadelin511 on 2013-03-13 12:25:31


Use formvalidator-4.1.3.js for email format check.
This is written in the following way.

$ ("#email"). Formvalidator ({onshow: "Please enter the mailbox", onfocus: "Mailbox 6-100 characters, entered correctly to leave the focus", Oncorrect: "Congratulations, you lost the right", DefaultValue: " @ "}). Inputvalidator ({min:6,max:100,onerror:" The length of the mailbox you entered is illegal, 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 mailbox you entered is not in the correct format "});


Test normal in a static Web page. But in the thinkphp template file, the parsed code becomes the
REGEXP: "^ ([ \w-.] +) @ ([[[0-9]{1,3}. [0-9] {1,3}. [0-9] {1,3}.) | ([\\w-]+.) +)) ([a-za-z]{2,4}| [0-9] {1,3}) (]?) $"

Causes the Formvalidator "character set to cross out" issue.

Why the expression was changed. \\w became \w?
Please help us to confirm!
thinkphp Formvalidtor Character set out of bounds


------Solution--------------------
The template file is read into the variable, so \\w becomes the \w
To write \\\w or \\\\w
------Solution--------------------
This is not clear, need to see PHP C source code to analyze the reason
But it's not something anyone can do.
The actual use also do not have to delve into, encounter add a "\" not when you add one, so loop know not error

You can see a lot of code in foreign countries there will be four or five consecutive \
  • 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.