The regexp of JavaScript

Source: Internet
Author: User
Tags instance method

Divided into literal and regexp constructors

1, regular expression matching mode support 3 flags

G: Represents the global pattern, and the pattern is applied to all strings, not immediately when the first match is found

I: Indicates case-insensitive mode, which ignores pattern and string case when determining matches

M: Represents a multiline pattern that, when the end of a line of text is reached, continues to find out if there are items in the next row that match the pattern.

RegExp Instance Properties

Global: Indicates the G flag is set

Ignorecase:i

Multiline:m

LastIndex: Integer that represents the character position at which to start searching for the next occurrence, starting from 0

Source: A string representation of a regular expression that is returned in literal form rather than in the string pattern in the incoming constructor.

RegExp instance method

EXEC () is specifically designed for capturing groups. parameter is the string to which the pattern is to be applied, and then returns an array containing the first occurrence information, or null if no match is found. The returned array, although an instance of array, contains two additional attributes. Index represents the position of the match in the string, and input represents the string that applies the regular expression.

Look at the headache, this piece does not understand, see later.

The regexp of JavaScript

Related Article

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.