Regular expressions need to escape special characters __ Regular expressions

Source: Internet
Author: User

Some characters in a regular expression have special meanings, and if you want to use its meaning in a match, you need to escape (precede it with a \). The following is a summary of some of the common special characters that need to be escaped: $ matches the end position of the input string. If the multiline property of the RegExp object is set, then $ also matches, such as ' \ n ' or ' \ R '. () marks the start and end position of a subexpression. The subexpression can be obtained for later use. To match these characters. * Match the preceding subexpression 0 or more times. + Match the preceding subexpression one or more times ... Matches any single character except the newline character \ n. [] marks the beginning of a bracket expression. Match the face expression 0 or more times, or indicate a non greedy qualifier \ mark the next character or special character or literal character or a back reference or octal escape character. For example: ' n ' matches the character ' n ' and ' \ n ' matches a newline character. The sequence ' \ \ ' matches ' ^ ' matches the starting position of the input string, unless used in a bracket expression, at which point he does not accept the character set. {} marks the beginning of a qualifier expression. | Indicates a choice between two items. General statement: *.? + $ ^ [] () {} | \/

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.