Opening a door: regular expression (1)

Source: Internet
Author: User

The regular expression is a regular expression. It seems that English is better understood than Chinese, that is, checking expression characters
Not compliant !! Regular expressions have a very powerful and complex object RegExp. In JavaScript1.2
.
Let's take a look at the introduction of regular expressions:
The regular expression object is used to regulate a standard expression (that is, the expression operator does not meet specific requirements, such as whether it is an Email
It has the attributes and methods used to check whether the given string meets the rules.
In addition, the attributes of individual regular expression objects created by using the RegExp constructor have been pre-defined.
You can use static attributes of objects at any time.
Core objects:
Available in JavaScript 1.2 and NES 3.0 and later versions.
The toSource method is added in Versions later than JavaScript 1.3.
Creation method:
Text format or RegExp constructor function.
The text format is as follows:
/Pattern/flags:/mode/flag
The constructor function method is as follows:
New RegExp ("pattern" [, "flags"]) is new RegExp ("Mode" [, "flag"])
Parameters:
Pattern)
Indicates the text of a regular expression.
Flags)
If this option is specified, flags can be one of the following nominal values:
G: global match (exact match)
I: ignore case (case insensitive)
Gi: both global match and ignore case (matching all possible values, case Insensitive)
Note: Do not Mark parameters in text format with quotation marks, while parameters in constructors must be marked with quotation marks. So the following
The expression creates the same regular expression:
/AB + c/I
New RegExp ("AB + c", "I ")
Description:
When using constructor, you must use normal strings to avoid rules (add leading characters to strings.

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.