3-parameter g,i,m__ regular expressions for JavaScript regular expressions

Source: Internet
Author: User
Web site for testing:

Http://www.pagecolumn.com/tool/regtest.htm
the string used for testing is:

Bsdfefsdf
Aaa
Dfsdfa
AAA G: Global lookup Mode

No g will only match 1, plus g to find all the matches

Regular expression:

/aaa/
The results match the following:
Bsdfefsdf
Aaa
Dfsdfa

Aaa


Regular expression:

/aaa/g
The result matches the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa I: Do not distinguish between sizes

Regular expression:

/aaa/i
The result matches the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa
m: Multi-line Lookup mode

The default ^ and $ match only the beginning and end of the string, such as:

Regular expression:

/^aaa/ 

will not match the test string, because the test data 4 lines as a whole, the beginning is BSD rather than AAA

Regular expressions

The results match the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa

With the M argument, ^ and $ can match the beginning and end of each row, but only the first one, such as:

The results match the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa



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.