Regular expressions (common expressions)

Source: Internet
Author: User
Tags control characters printable characters alphanumeric characters

X Character x
\\ Backslash character
/ N Characters with octal value 0 n (0 <= n <= 7)
/ nn Character nn with octal value 0 (0 <= n <= 7)
/ Mnn Characters with octal value 0 mnn(0 <= m <= 3, 0 <= N <= 7)
\x hh Character hh with hexadecimal value of 0x
\u HHHH Character with hexadecimal value of 0x hhhh
\ t tab (' \u0009 ')
\ n New lines (line break) (' \u000a ')
\ r Carriage return character (' \u000d ')
\f Page break (' \u000c ')
\a Alarm (Bell) character (' \u0007 ')
\e Escape character (' \u001b ')
\c x The control that corresponds to x
[ABC] a,b or C(Simple Class)
[^ABC] Any character except a,b , or C(negation)
[A-za-z] a to z or a to z, the letters at both ends are included (range)
[A-d[m-p]] a to D or m to p:[a-dm-p](set)
[A-z&&[def]] d,e or F(intersection)
[A-Z&&[^BC]] a to Z, except for b and C:[ad-z](minus)
[A-z&&[^m-p]] a to z, not m to p:[a-lq-z](minus)
. Any character (may or may not match the line terminator)
\d Numbers:[0-9]
\d Non-numeric: [^0-9]
\s whitespace characters:[\t\n\x0b\f\r]
\s Non-whitespace characters:[^\s]
\w Word character:[a-za-z_0-9]
\w Non-word characters:[^\w]
\p{lower} Lowercase alphabetic characters:[A-z]
\p{upper} Uppercase characters:[A-z]
\P{ASCII} All ASCII:[\x00-\x7f]
\p{alpha} Alphabetic characters:[\p{lower}\p{upper}]
\p{digit} Decimal number:[0-9]
\p{alnum} Alphanumeric characters:[\p{alpha}\p{digit}]
\P{PUNCT} Punctuation:! " #$%& ' () *+,-./:;<=>[email protected][\]^_ ' {|} ~
\p{graph} Visible characters:[\p{alnum}\p{punct}]
\p{print} printable characters:[\p{graph}\x20]
\p{blank} Space or tab:[\ t]
\p{cntrl} Control characters:[\x00-\x1f\x7f]
\p{xdigit} Hex Number:[0-9a-fa-f]
\p{space} whitespace characters:[\t\n\x0b\f\r]
\p{javalowercase} Equivalent to Java.lang.Character.isLowerCase ()
\p{javauppercase} Equivalent to Java.lang.Character.isUpperCase ()
\p{javawhitespace} Equivalent to Java.lang.Character.isWhitespace ()
\p{javamirrored} Equivalent to java.lang.Character.isMirrored ()
\p{ingreek} Greek characters in a block (simple block)
\p{lu} Capital letters (Simple category)
\P{SC} Currency symbol
\p{ingreek} All characters except (negation) in the Greek block
[\p{l}&&[^\p{lu}] All letters, except capital letters (minus)
^ The beginning of the line
$ End of Line
\b Word boundaries
\b Non-word boundary
\a Start of input
\g End of last match
\z The end of the input, only for the last terminator (if any)
\z End of input
X ? X, not once or once
X * X, 0 or more times
X + X, one or more times
X {n} X, exactly n times
X {n,} X, at least n times
X {n,m} X, at least n times, but not more than m Times
X ?? X, not once or once
X *? X, 0 or more times
X +? X, one or more times
X {n}? X, exactly n times
X {n,}? X, at least n times
X {n,m}? X, at least n times, but not more than m Times
X ?+ X, not once or once
X *+ X, 0 or more times
X ++ X, one or more times
X {n}+ X, exactly n times
X {n,}+ X, at least n times
X {n,m}+ X, at least n times, but not more than m Times
Xy X followed by Y
X | Y X or Y
(X) X, as capturing group
\ N Any matching n-th capturing group
\ Nothing, but references the following characters
\q Nothing, but all characters are quoted until \e
\e Nothing, but the end of the reference starting from \q
(?:X) X, as a non-capturing group
(? idmsux-idmsux) Nothing, but will match the flag i d M s u x on-off
(? Idmsux-idmsux:X) x, as with the given flag I d M s u X on-off
(? =X) X, through a 0-width positive lookahead
(?! X ) X, through a 0-width negative lookahead
(? <=X) X, through a 0-width positive lookbehind
(? <! X ) X, through a 0-width negative lookbehind
(?>X) X, as a standalone, non-capturing group

Regular expressions (common expressions)

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.