Regular Expression, Regular Expression

Source: Internet
Author: User

Regular Expression, Regular Expression

Id Regex Match
1 [Abc] A, B, or c (simple class)
2 [^ Abc] Except a, B, or c (NO)
3 [A-zA-Z] In a to z or A to Z, letters at both ends are included (characters in the range)
4 [A-d [m-p] Characters from a to d or m to p: [a-dm-p] (union)
5 [A-z & [def] D, e, or f (intersection)
6 [A-z & [^ bc] A to z, except for B and c: [ad-z] (minus)
7 [A-z & [^ m-p] A to z, rather than m to p: [a-SCSI-z] (minus)
8 A-zA-Z0-9 + Match multiple characters
9 \ D Number: [0-9]
10 \ D Non-digit: [^ 0-9]
11 \ S Blank characters: [\ t \ n \ x0B \ f \ r]
12 \ S Non-blank characters: [^ \ s]
13 \ W Word character: [a-zA-Z_0-9]
14 \ W Non-word characters: [^ \ w]

In a regular expression, () is used to capture a group. Each group has a number starting from 1, and group zero always represents the entire expression. The captured subsequence can be used in the expression later through \ n (Back Reference, n is the group number. For example, you can use"(.)\\1+"Split strings with overlapping words."."It indicates that any character can be matched,(.)Used to capture a group,\\1Used to obtain captured subsequences,+Indicates one or more.

Ongoing supplements ······

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.