Java to find personal understanding before and after

Source: Internet
Author: User

One of the simplest chestnuts

This is about the position of 0 wide, before or after

Http://www.sb.com

1. Forward Forward Lookup

(1)

If you use:. * (? =:)

First (? =:) is called a 0-width assertion, the so-called 0 width should be inserted between P and: the 0 width

This is a canonical usage, matching HTTP, not including:

(2) Order of Change

(?=:).*

(? =:) or 0 width between p and:, so match://www.sb.com, contains:

2. Forward Reverse Lookup

(1)

.*(?!:)

Match all, because http://www.sb.com behind does not have:, meaning is: words, can't match: the previous paragraph, no words, equivalent. *

(2) Order of Change

(?!:) .*

Match all, as long as the match result is not in front of it: Yes

3. Back forward Lookup

(? <=\$) [0-9.]+

I need 100$100

0 wide interpolation in the back of $, so does not contain $, matches 100

Change Order

[0-9.]+ (? <=\$)

Not match, thought 100$ would contain

[0-9.\$]+ (? <=\$)

Will match to 100$.

4. Back to negative lookup

I paid $7000 for 1 apple

\b (? <!\$) \d+\b

That is, if there are $, followed by numbers, do not.

Change Order

\b\d+ (? <!\$) \b

Matches 7000 and 1, as long as 7000 and 1 are not after $

The new discovery is that $7000 is also counted as a word boundary.

Http://www.sb.com

Java to find personal understanding before and after

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.