admin管理员组

文章数量:1579086

ConstructMatches
Characters
xThe characterx
\\The backslash character
\0n The character with octal value0n(0<=n<=7)
\0nn The character with octal value0nn(0<=n<=7)
\0mnn The character with octal value0mnn(0<=m<=3, 0<=n<=7)
\xhh The character with hexadecimalvalue0xhh
\uhhhh The character with hexadecimalvalue0xhhhh
\tThe tab character ('\ ')
\nThe newline (line feed) character ('\ ')
\rThe carriage-return character ('\ ')
\fThe form-feed character ('\ ')
\aThe alert (bell) character ('\')
\eThe escape character ('\')
\cx The control character corresponding tox
Character classes
[abc] a,b, orc(simple class)
[^abc]Any character excepta,b, orc(negation)
[a-zA-Z] athroughzorAthroughZ, inclusive (range)
[a-d[m-p]] athroughd, ormthroughp:[a-dm-p](union)
[a-z&&[def]] d,e, orf(intersection)
[a-z&&[^bc]] athroughz, except forbandc:[ad-z](subtraction)
[a-z&&[^m-p]] athroughz, and notmthroughp:[a-lq-z](subtraction)
Predefined character classes
.Any character (may or may not matchline terminators)
\dA digit:[0-9]
\DA non-digit:[^0-9]
\sA whitespace character:[ \t\n\x0B\f\r]
\SA non-whitespace character:[^\s]
\wA word character:[a-zA-Z_0-9]
\WA non-word character:[^\w]
POSIX character classes (US-ASCII only)
\p{Lower}A lower-case alphabetic character:[a-z]
\p{Upper}An upper-case alphabetic character:[A-Z]
\p{ASCII}All ASCII:[\x00-\x7F]
\p{Alpha}An alphabetic character:[\p{Lower}\p{Upper}]
\p{Digit}A decimal digit:[0-9]
\p{Alnum}An alphanumeric character:[\p{Alpha}\p{Digit}]
\p{Punct}Punctuation: One of!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
\p{Graph}A visible character:[\p{Alnum}\p{Punct}]
\p{Print}A printable character:[\p{Graph}]
\p{Blank}A space or a tab:[ \t]
\p{Cntrl}A control character:[\x00-\x1F\x7F]
\p{XDigit}A hexadecimal digit:[0-9a-fA-F]
\p{Space}A whitespace character:[ \t\n\x0B\f\r]
Classes for Unicode blocks and categories
\p{InGreek}A character in the Greekblock (simpleblock)
\p{Lu}An uppercase letter (simplecategory)
\p{Sc}A currency symbol
\P{InGreek}Any character except one in the Greek block (negation)
[\p{L}&&[^\p{Lu}]]Any letter except an uppercase letter (subtraction)
Boundary matchers
^The beginning of a line
$The end of a line
\bA word boundary
\BA non-word boundary
\AThe beginning of the input
\GThe end of the previous match
\ZThe end of the input but for the finalterminator, ifany
\zThe end of the input
Greedy quantifiers
X? X, once or not at all
X* X, zero or more times
X+ X, one or more times
X{n} X, exactlyntimes
X{n,} X, at leastntimes
X{n,m} X, at leastnbut not more thanmtimes
Reluctant quantifiers
X?? X, once or not at all
X*? X, zero or more times
X+? X, one or more times
X{n}? X, exactlyntimes
X{n,}? X, at leastntimes
X{n,m}? X, at leastnbut not more thanmtimes
Possessive quantifiers
X?+ X, once or not at all
X*+ X, zero or more times
X++ X, one or more times
X{n}+ X, exactlyntimes
X{n,}+ X, at leastntimes
X{n,m}+ X, at leastnbut not more thanmtimes
Logical operators
XY Xfollowed byY
X|Y EitherXorY
(X) X, as acapturing group
Back references
\n Whatever thenthcapturing groupmatched
Quotation
\Nothing, but quotes the following character
\QNothing, but quotes all characters until\E
\ENothing, but ends quoting started by\Q
Special constructs (non-capturing)
(?:X) X, as a non-capturing group
(?idmsux-idmsux)Nothing, but turns match flags on - off
(?idmsux-idmsux:X) X, as anon-capturing groupwith the given flags on - off
(?=X) X, via zero-width positive lookahead
(?!X) X, via zero-width negative lookahead
(?<=X) X, via zero-width positive lookbehind
(?<!X) X, via zero-width negative lookbehind
(?>X) X, as an independent, non-capturing group

本文标签: 定义正则表达式Eclipse