Regular Expressions limit text input

Source: Internet
Author: User

<P> </P> <P> lowercase English: <xmp style = "display: inline "> </xmp> <input id = test onkeypress =" regInput (/^ [a-z] * $/) "style =" ime-mode: disabled "> uppercase English: <xmp style =" display: inline "> </xmp> <input id = test onkeypress =" regInput (/^ [A-Z] * $ /) "style =" ime-mode: Disabled "> Any number: <xmp style =" display: inline "> </xmp> <input id = test onkeypress =" regInput (/^ [0-9] * $/) "style =" ime-mode: disabled "> limited to 2 decimal places: <xmp style =" display: inline "> </xmp> <inpu T id = test onkeypress = "regInput (/^ \ d *\.? \ D {123.12 }$/) "style =" ime-mode: Disabled "> for example, Date: <xmp style =" display: inline "> </xmp> <input id = test onkeypress =" regInput (/^ \ d {1, 4} ([-\/] (\ d {1, 2 }([-\ /] (\ d {1, 2 })?)?)?)? $/) "Style =" ime-mode: Disabled "> for example, 2002-9-29 any Chinese: <xmp style =" display: inline "> </xmp> <input onkeypress =" regInput (/^ $/) "> English: <xmp style =" display: inline "> </xmp> <input onkeypress =" regInput (/^ [a-e] * $/I) "style =" ime-mode: Disabled "> range: a, B, c, d, e Chinese: <xmp style = "display: inline "> </xmp> <input onkeypress =" return false "onkeydown =" setTimeout ('checkchinese ('+ this. value. length + ',' + this. uniqueID + ')', 1) "> scope: 80 or 90, </P>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.