JavaScript Regular Expressions

Source: Internet
Author: User

Regular Expressions:

Regular Expressions (Regular expression), also known as formal notation , conventional notation .

A regular expression uses a single string to describe and match a series of strings that conform to a certain syntactic rule.

Method:

1. Reg.test (strobject)

returns a Boolean value . Used to test for the presence of a regular expression pattern in a string parameter, and returns True if present, otherwise false

2. Reg.exec (Strobject)

returns an array or null.

method is used for the regular expression pattern to run a lookup in a string, and if Exec () finds the matched text, it returns an array of results. Otherwise, NULL is returned.

In addition to the above two methods, some string functions can be passed into the RegExp object as parameters for some complex operations

You can refer to this article for comparisons like manuals, except that the escape symbol "\" is written incorrectly as "/". Manual

Also refer to the article. Illustrated two illustrations

JavaScript Regular Expressions

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.