Java Regular Expressions

Source: Internet
Author: User

First, meaning:

  is a regular, meaningful string of characters, usually used for matching, finding, and so on.

Second, commonly used symbols

  .: Any character

[ABC]: denotes any one of the letters in ABC

[^ABC]: denotes any character other than ABC

[0-9]: Represents any number in 0-9

[A-Z]: denotes any letter in a-Z

[0-9a-za-z]: represents any one of these characters

[A-Z&&[^ABC]]: represents any character other than ABC in a-Z

[\d]: Represents any number in 0-9

[\d]: represents any character in a non-digit

[\w]: denotes any one of the word characters, equivalent to [0-9a-za-z]

[\w]: denotes any one other than the word character

[\s]: means [\n\t\r\f], blank

[\s]: indicates non-whitespace

\d*: Indicates that there are 0 or 0 or more digits

\d?: indicates no or 1 digits.

\d+: Indicates that there are 1 or more than 1 digits

\d{n}: Indicates a number marked with n

\d{n,} indicates that there are more than N or n digits

\d{n,m}: Indicates a n-m number

 

   (): Indicates grouping

When writing a string, to express the character "\", you must add the escape character "\"in front.

Java Regular 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.