Regular expressions and POSIX identity character sets

Source: Internet
Author: User
Tags alphabetic character posix

Regular expression meta-character set

^ Anchoring the beginning of a line, such as matching lines starting with ABC ' ^ABC '

$ anchor Line endings, such as matching lines ending with xyz ' xyz$ '

. Match an arbitrary character, such as ' AB.C ' matches with AB beginning with any one character in the middle of the C end

* Match 0 or more * preceding characters, such as ' abc*d ' match with AB beginning with D end Middle has at least one C

[] matches a specified range of characters, such as ' a[bc]d ' matches a beginning D ending, a middle character is B or c,abd or ACD, such as ' a[0-9]b ' matches a starts with a B ending, a number in the middle

[^] matches characters outside the specified range, such as ' a[^bc]d ' matches with a D ending with a, middle character neither B nor C

\< anchor words, such as ' \<abc ' matches lines of words starting with ABC

\> anchor ending, such as ' xyz\> ' matches lines of words ending with XYZ

X\{m\} matches characters x,m times, as ' a\{3\} ' matches rows of 3 consecutive a

X\{m,\} matches a character x, at least m times, such as ' a\{3,\} ' matches a row of at least 3 consecutive a

X\{m,n\} matches character X, at least m times, up to n times, such as ' a\{2,5\} ' matches rows of at least 2 consecutive a at most 5 a

. * matches any character

\(.. \) tag matching characters, such as ' \ (love\) ', Love is marked as 1


POSIX identity Character Set

[: Alnum:]: Letters or numbers

[:d igit:]: Numeric characters

[:p UNCT:]: Punctuation

[: Alpha:]: Alphabetic character

[: Graph:]: non-whitespace character

[: Space:]: space character

[: Blank:]: Spaces and tabs

[: Lower:]: lowercase letters

[: Upper:]: Uppercase

[: Cntrl:]: Control character

[:p rint:]: Print characters


Regular expressions and POSIX identity character sets

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.