Regular expressions detailing the first part _ regular expressions

Source: Internet
Author: User
Regular expression is regular expression, it seems that English is better than Chinese understand more, is to check expression characters do not conform to the rules!! Regular expressions have a very powerful and complex object RegexpInJavascript1.2Version above provided.

Let's look at an introduction to regular expressions:
Regular expression objects are used to standardize an expression of a specification (that is, an expression character that does not meet a specific requirement, such as an email address format, etc.), and it has properties and methods for checking whether the given string conforms to the rules.
In addition, the properties of the individual regular expression objects that you set up with the RegExp constructor have predefined static properties of regular expression objects that you can use at any time.

Core objects:
In JavaScript 1.2, NES more than 3.0 versions are available.
After the JavaScript 1.3 version added the Tosource method.

To establish a method:
Text formatting or regexp constructor functions.
Text formatting uses the following format:
/pattern/flags/Mode/tag

The constructor function method uses the following methods:
New RegExp ("pattern" [, "Flags"]) is new REGEXP ("mode" [, "tag"])

Parameters:
Pattern (Mode)
Text that represents the regular expression

Flags (tags)
If you specify this item, flags can be one of the following denominations:
G:global match (full set matching)
I:ignore case (ignoring capitalization)
Gi:both Global Match and ignore case (matches all possible values, also ignores capitalization)

Note: The parameters in the text format do not use quotation marks, and constructor function parameters are marked with quotation marks. So the following expression establishes the same regular expression:
/ab+c/i
New RegExp ("Ab+c", "I")

Describe:
When using constructors, it is necessary to use normal string avoidance rules (adding leading characters in a string).
For example, the following two statements are equivalent:
Re = new RegExp ("\\w+")
Re =/\w+/

Source: U/meil/rss2.xml

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.