Regular Expression-simple memory

Source: Internet
Author: User

Many programming languages support the use of regular expressions for string matching. Regular Expressions are always a bit fuzzy. Here, we will record them and review them later.

"." Represents any character

"\ D" represents any number ranging from 0 to 9

"\ D" represents any non-Numeric Character

"\ S" represents space characters

"\ S" indicates non-space characters

"\ W" represents characters that can be used as identifiers


Starts with a pair of square brackets and represents any character in square brackets.

[ABC] represents any one of a B c

[^ ABC] represents any character except a B c

[A-d] represents any one of A to D

[A-d [M-p] A to D, or any one of m to P (union)

[A-Z & [DEF] represents any one of d e f (intersection)

[A-F & [^ BC] represents a d e f (difference set)

With a qualifier

X? X appears 0 this or once

X + x appears once or multiple times

X appears 0 or multiple times

X {n} X exactly appears n times

X {n,} X appears at least N times

X {n, m} X appears n to m times


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: 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.