Regular expression meta-character collation

Source: Internet
Author: User

Basic Regular Expressions

Match characters:

. : matches any single character.

[]: matches characters within a specified range

[::] : Character Set

[: space:] Space character

[: Lower:] Lowercase Letters

[: Upper:] Uppercase Letters

[: Alpha:] uppercase and lowercase letters

[:d igit:] Digital

[: alnum:] numbers and uppercase and lowercase letters

[^]: matches a character outside a specified range

Number of matches:

*  : matches the preceding character of the symbol any time.

.* : matches any character any time.

\?: match its first character 1 Times or 0 times.

Location anchoring:

^ : The character followed must be at the beginning of the line.

$: the preceding character must be at the end of the line.

^$: blank line.

\b or \< : The character followed must be the word header.

\b or \>: The preceding character must be the tail of the word.

Group:

\(\): group content as a whole, can appear any time eg: \ (root\)

back reference:

\ 1: The first opening parenthesis and the corresponding closing parenthesis contain the contents.

\2: ....

\3: ....

Extending regular Expressions

Character Matching:

. :

[] :

[::]:

[^]: the above are all the same as the basic regular expression

Number of matches:

*:

?: above with the basic regular expression

+: match its first character at least 1 times, with \ (1,\) .

{m,n}: the match period before the character at least m times, the more N times.

Anchor Position:

The same basic regular expression.

Group:

(): don't need \ .

| : Or, a|b:a or b,c| Cat:c or Cat.


Regular expression meta-character collation

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.