Regular Expression backup

Source: Internet
Author: User

Year:/^ 19/d {2 }$/(20th century)
Month: ^/d {1, 2} $

Character Description:

^ Matches the start of a string. For example:

^ ABC matches "abc xyz" instead of "xyz abc"

$ Symbol matches the end of a string. For example:

ABC $ matches "xyz abc" instead of "abc xyz.

NOTE: If both the ^ and $ symbols are used, exact match is performed. For example:

^ ABC $ only matches "ABC"

* The symbol matches 0 or more characters before it. For example:

AB * can match "AB", "ABB", "abbb", etc.

+ The symbol matches at least one character before it. For example:

AB + can match "ABB", "abbb", but does not match "AB ".

? The symbol matches 0 or 1 character. For example:

AB? C? Only "ABC", "abbc", "ABCC", and "abbcc" can be matched"

The. symbol matches any character except the line break. For example:

(.) + Match all strings except line breaks

X | y matches "X" or "Y ". For example:

ABC | XYZ can match "ABC" or "XYZ", while "AB (c | x) YZ" matches "abcyz" and "abxyz"

{N} matches exactly the characters before n times (N is a non-negative integer. For example:

A {2} can match "AA", but does not match ""

{N,} matches the characters before at least N times (N is a non-negative integer. For example:

A {3,} matches "AAA", "aaaa", but does not match "A" and "AA ".

Note: A {1,} is equivalent to a +

A {0,} is equivalent to *

{M, n} matches at least m characters, and at most n characters are prefixed. For example:

A {1, 3} Only matches "A", "AA", and "AAA ".

Note: A {0, 1} is equivalent to?

[Xyz] indicates a character set that matches one of the characters in brackets. For example:

[ABC] matches "A", "B", and "C"

[^ XYZ] indicates a negative character set. Match any character that does not exist in this bracket. For example:

[^ ABC] can match any character except "A", "B", and "C"

[A-Z] indicates characters in a certain range. It matches any character in a specified range. For example:

[A-Z] matches any lowercase letter character from "A" to "Z"

[^ M-N] indicates a character out of a certain range, matching a character that is not in the specified range. For example:

[M-N] matches any character except "M" to "N"

/Symbols are escape operators. For example:

/N linefeed

/F paging character

/R press ENTER

/T Tab

/V vertical Tab

// Match "/"

// Match "/"

/S any white characters, including spaces, tabs, and pagination characters. It is equivalent to "[/f/n/R/T/V]"

/S any non-blank characters. It is equivalent to "^/f/n/R/T/V]"

/W any word character, including letters and underscores. Equivalent to "[A-Za-z0-9 _]"

/W any non-word characters. Equivalent to "[^ A-Za-z0-9 _]"

/B matches the end of a word. For example:

Ve/B matches the word "love", but does not match "very" or "even ".

/B matches the start of a word. For example:

Ve/B matches the word "very", but does not match "love ".

/D matches a number, which is equivalent to [0-9]. For example:

ABC/dxyz matches "abc2xyz", "abc4xyz", etc,
But does not match "abcaxyz", "ABC-XYZ", etc.

/D matches a non-numeric character, which is equivalent to [^ 0-9]. For example:

ABC/dxyz matches "abcaxyz", "ABC-XYZ", etc,
But does not match "abc2xyz", "abc4xyz", etc.

/Num matches num (where num is a positive integer) and references it back to the remembered match. For example:

(.)/1 matches two consecutive identical characters.

/Onum matches N (where N is an octal value less than 256 ). For example:

/O011 match the tab

/Xnum matches num (Num is a hexadecimal value less than 256 ). For example:

/X41 match the character ""

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.