Java Regular expression "use syntax"

Source: Internet
Author: User

3. Regular expressions
A string consisting of some special meaningful characters (rote)
Atomic: The most basic constituent unit of a regular expression
The character of the regular expression special meaning:. + They cannot be represented individually, and if they are to be represented, they need to be
\ While in Java \ the string needs \ \ Represent
So to represent the above four characters will be used \ \.  \\*  \\? \\+
Special significance
3.3 Meta characters
Used to modify atoms, not to appear alone.
. Any character other than line breaks
* Indicates that the atom can occur 0 times 1 or more times {0}
? {0,1}
+ {1,}

{} Number of times a custom atom appears
{m} appears m times
{M,n}m to n times, including m,n
{m,} appears at least m times
^ What must I start with?
What must be the end of the $
| Representation or relationship
\\d represents an arbitrary decimal number [0-9]
\\d represents any character other than a number.
\\s represents an arbitrary blank word spaces [\n\r\t\f]
\\s represents a non-blank
\\w denotes any one character (alphanumeric underscore) a-za-z0-9_[a-za-z0-9_]
\\w means non-a-za-z0-9_
D. Define an atom yourself
[Any one between the 0-9]0-9
[5-8]
[A-z5-8]
[^0-9] ^ representative take the reverse
[]

Patten

String: Matches split

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java Regular expression "use syntax"

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.