Character of regular expression, positional character and repeating character

Source: Internet
Author: User
Tags character classes expression regular expression
Regular | repeat
Character classes represented by regular expression syntax
Character class Matching characters Example
\d Numbers from the 0~9 \d\d can match 72, but cannot match 7a or A7
\d Characters that are not numeric \d\d\d can match a%c, but cannot match 123
\w Underline and Word characters \w\w\w can match a2_, but cannot match x&a
\w Non-word characters and underscores \w\w can match &^, but cannot match A1
\s Blank characters, including tabs, line breaks, carriage returns, page breaks, and Vertical tabs
\s Non-whitespace characters
. Any character
[...] Any character within the parentheses

[ABC] matches a single character a,b or C, but does not match other characters

[A-z] matches any character of A~z

[^...] Any character not in parentheses

[^ABC] matches any character that a,b,c out

[A-z] matches any character that is not a~z, but matches large letters







positioning character
positioning character
^

$
\a
\z The preceding pattern must be at the end of the string; The multiline flag is ignored
\z < Font face= The preceding pattern must be at the end of the string, or before the newline character
\b< /font>
\b




repeat character < Font face= "boldface" meaning example
{n} x{2} match xx, but does not match X, or xxx
{n,} x{2, matches xx or xxx and more x,
{n, m} x{2,4} matches Xx,xxx , XXXX but does not match X, or xxxxx
". matches the preceding character 0 or 1 times/td> x? Match x or null
+ matches the preceding characters 1 or more x+ matches x or so many x
* x* match empty or more x








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.