RegExp object (Regular expression)

Source: Internet
Author: User

The so-called regular expression, is to use a pattern to match a class of characters of a formula. The reaction to JS is a RegExp object.

It can also be said that the RegExp object represents a regular expression, which is a tool that performs pattern matching on a string.

There are two ways to create a RegExp object:

  1. Direct volume Syntax:/pattern/attributes
  2. Syntax created by the RegExp class's construction:new REGEXP (pattern, attributes)

Parameter pattern is a required parameter that specifies the pattern string that needs to be matched

The parameter attributes is an optional parameter that contains the attribute "G" "I" "M", respectively, for specifying global match, case-sensitive matching, and multiline matching.

To find characters in a range:

Metacharacters: Characters with special meanings

Quantifiers:

RegExp Object Properties:

RegExp object (Regular expression)

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.