Powerful RegEx tool: matchresult in org. Apache. Oro. Text. RegEx

Source: Internet
Author: User

Matchresult can be understood as a combination of string matching RegEx pattern and some state items.

But there are two points to note:

1. Frequently used:

Result = matcher. getmatch ();

The returned matchresult is the result obtained when contains is used this time. Next, call a new round of contains (), and then use getmatch () to return a new round of results.

2. Understanding of a concept: Group

The so-called group is the group used in pattern RegEx.

For example, a RegEx is: (\ D +) (ABC)

The result of "(\ D +)" match corresponds to Group 1.

The result of "(ABC)" Match corresponds to group 2.

Group 0 indicates the entire match. Result. group (0) has the same effect as result. tostring.

Note that the number of group groups is at least 1 (because it includes at least the entire match !)

 

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.