Regular Expression Object

Source: Internet
Author: User

1. RegExp Object Overview

The RegExp object represents a regular expression, which is a powerful tool for performing pattern matching on strings

Creating a regular Expression object

var rgexp=/pattern/flags;

var rgexp=new RegExp ("pattern", ["flags"]);

The flags are identified in the following several:

G: Set current match to global mode

I: Ignore case detection in match

M: Multi-line search mode

2. Common methods of RegExp objects

Regexpobject.test (String)

Returns True if the string contains text that matches regexpobject, otherwise false

Reg.compile (Pattern,[flags]): Compiling regular expressions

Reg.exec (STR): Retrieves the value specified in the string to return the found values and determines its location

Reg.test (STR): Retrieves the value specified in the string, returning True or false

Regular Expression Object

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.