Regular Expressions in Java

Source: Internet
Author: User

 

Constructor of a regular expression

Structure Match
 
Character
X Character
X
\\ Backslash characters
\ 0N With octal values
0CharacterN(0<= N <=7)
\ 0Nn With octal values
0CharacterNn(0<= N <=7)
\ 0Mnn With octal values
0CharacterMnn(0<= M <=3. 0<= N <=7)
\ XHH With hexadecimal value0xCharacter
HH
\ UHhhh With hexadecimal value0xCharacter
Hhhh
\ T Tab ('\ U0009')
\ N New Line (line feed) character ('\ U000a')
\ R Carriage Return ('\ U000d')
\ F Page feed ('\ U000c')
\ Alarm (Bell) operator ('\ U0007')
\ E Escape Character ('\ U001b')
\ CX Corresponds
X
Controller
 
Character class
[ABC] A,BOr
C(Simple class)
[^ ABC] Any character
A,BOrC(No)
[A-Za-Z] ATo
ZOrAToZ, Two letters included (range)
[A-d [M-p] ATo
DOrMToP:[A-DM-p](Union)
[A-Z & [DEF] D,EOr
F(Intersection)
[A-Z & [^ BC] ATo
Z,BAndC:[Ad-Z](Minus)
[A-Z & [^ m-p] ATo
Z, RatherMToP:[A-SCSI-Z](Minus)
 
Predefined character classes
. Any character (may or may not match the line terminator)
\ D Number:[0-9]
\ D Non-numeric:
[^ 0-9]
\ S Blank characters:[\ T \ n \ x0b \ f \ r]
\ S Non-blank characters:[^ \ S]
\ W Word character:A-zA-Z_0-9
\ W Non-word characters:[^ \ W]
 
POSIX character class (US-ASCII only)
\ P {lower} Lowercase letter:[A-Z]
\ P {upper} Uppercase letter:A-Z
\ P {ASCII} All ASCII:[\ X00-\ x7f]
\ P {Alpha} Letter:[\ P {lower} \ P {upper}]
\ P {digit} Decimal number:[0-9]
\ P {alnum} Alphanumeric characters:[\ P {Alpha} \ P {digit}]
\ P {punct} Punctuation:! "# $ % & '() * +,-./:; <=>? @ [\] ^ _ '{| }~

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.