Javascip-regular expression

Source: Internet
Author: User

To sum up the regular expression usage:

<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> <HTML>  Code It can be placed in any location and executed sequentially among head labels --> <SCRIPT type = "text/JavaScript"> //  The subexpression captures reverse references to meet the condition that the first and last bits are the same, and the second and third bits are the same 4-digit var Regexp =/(\ D) \ 2 \ 1/GI;      Function  Test (){  VaR Con = Document. getelementbyid ("content" ). Value;  // Number of consecutive three {n },          //  VaR Regexp =/A {2} 1 {3}/GI;          //  {N, m} At Least n times at most m times. js greedy principle: Match multiple times first and then match fewer times.          //  VaR Regexp =/1 {3, 4}/GI;          //  + Indicates that the message appears once to any number of times.          //  VaR Regexp =/1 +/GI;          //  * Indicates 0 to any number of times          //  VaR Regexp =/A1 */GI;          // ? 0 to 1          //  VaR Regexp =/A1? /GI;          //  [A-Z]          //  VaR Regexp =/\./GI;          //  ^ Start $ end Locator          //  VaR Regexp =/Han $/GI;          //  \ B matches the target string of the boundary (such as space separation) \ B opposite          //  VaR Regexp =/Han \ B/GI;          // | Select matching          VaR Regexp =/(Pan | disk )/ GI;  While (RES = Regexp.exe C (CON) {window. Alert (RES [ 0 ]) ;}} </SCRIPT> 

 

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.