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