A regular expression of javascript

Source: Internet
Author: User
Tags alphabetic character

Regular Expressions ( RegularExpression): According to a certain rule to match the qualifying string, through the built-in object RegExp support Regular expression, In general, a regular expression is a character that corresponds to a character string.

instantiation of the methods for REGEXP objects are: literals and constructors.

Common modifiers are: G Global full text Search, not added, search to the first match to stop.

I igonre case ignores casing, which is case sensitive by default.

m multiple lines multi-line search.

Regular expressions consist of two basic character types: literal text characters and metacharacters.

Metacharacters is a non-alphabetic character with a special meaning in a regular expression, such as: * \ [] {}? $^+| and so on.

Characters commonly used characters are: \ t horizontal tab

\v Vertical Tab

\ n line break

\ r return character

\o Empty characters

\f Page Break

\CX control character (ctrl+x) corresponding to X

Using [] to build a simple class, a class is an object that conforms to certain attributes, a generic rather than a character, such as an expression [ABC] that converts a character A or B or C to a class, and the expression can match such characters.

Using the metacharacters ^ to create a negative or inverse class, the reverse class means something that is not part of a class, such as: an expression [^ABC] represents something that is not a character A or B or C.

Use metacharacters-Create scope classes such as: [A-z] to concatenate two characters representing any character from A to Z, which is a closed interval that contains A and z itself.

in the [] the inner part of a class can be ligatures such as:[a-za-z].

If you want to remove the symbol class, write the symbol that you want to remove on the back of the page such as:[a-z-].

A regular expression 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.