Dark Horse Program Ape-------------of Java Network Technology (DAY06)

Source: Internet
Author: User
Tags character classes

----------------------Asp.net+unity Development,. NET Training, and look forward to communicating with you. ----------------------
The regular form of the expressionThe normal form: basic knowledge1 characters, 2 character class, 3 pre-defined character class, 4 Boundary match, 5 greedy number of words, 6 Logical operator
Specific explanations:
1 characters
XCharacter X
\\ Backslash character
\0nCharacters with octal value 0 N (0 <= n <= 7)
\0nnCharacter nn with octal value 0 (0 <= n <= 7)
\0mnnCharacters with octal value 0 mnn (0 <= m <= 3, 0 <= n <= 7)
\xhhCharacter hh with hexadecimal value of 0x
\uhhhhCharacter with hexadecimal value of 0x HHHH


\ ttab (' \u0009 ')
\ nNew lines (line break) (' \u000a ')
\ rCarriage return character (' \u000d ')
\fPage break (' \u000c ')
\aAlarm (Bell) character (' \u0007 ')
\eEscape character (' \u001b ')
\cxThe control corresponding to X

2 Character class
[ABC]a|b | C (Simple Class)
[^ABC]No matter what character.exceptA, B or C (negative)
[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&AMP;&AMP;[^BC]] A to Z, except B and C:[ad-z] (minus)
[A-z&&[^m-p]]A to Z. Rather than M to P:[a-lq-z] (minus)

3 defining character classes in advance
. Regardless of character (may or may not match the line terminator)
\dNumber: [0-9]
\dNon-numeric: [^0-9]
\swhitespace characters: [\t\n\x0b\f\r]
\sNon-whitespace characters: [^\s]
\w word character: [a-za-z_0-9]
\w non-word characters: [^\w]


4 Boundary Matching Device
^ The beginning of the line
End of the $ line
\bWord boundaries
\bNon-word boundary
\aStart of input
\gEnd of last match
\zThe end of the input, only for the last terminator (if any)
\zEnd of input




5 Greedy Quantity Words
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 no more than M-times




6 Logical operator
XY X followed by Y
X| Y X or Y
(x) x, as capturing group


Like what:the regular form of an email address: //Exact match
String reg = "[a-za-z0-9_]{6,12}@[a-za-z0-9]{3,6} (\\.[ a-za-z]+) {1,3} ";
A general match
String REG1 = "\\w+@\\w+ (\\.\\w+) +";


----------------------asp.net+unity Development,. NET training, looking forward to communicating with you. For----------------------details, please see: www.itheima.com

Dark Horse Program Ape-------------of Java Network Technology (DAY06)

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.