1. Balance Group/Recursive match
(?' Group ') will be named group corresponding to the content, stack count;
(?' -group ') will be named group of the corresponding content, out stack count
(?!) 0 wide Negative lookahead assertion, because there is no suffix expression, trying to match always fails
Regular examples:
, {0,1} "5": \[[^\[\]]* ((?) Open ' \[' [^\[\]]*] + ((?) -open ']) [^\[\]]*] +) * ( Open) (?!)) \],{0,1}
Test data:
{"0": ["0", "0-1", "0-2"], "1": ["1", "1-1", "" 1-2 "]," 2 ": [" 2 "," 2-1 "," 2-2 "]," 3 ": [" 3 "," 3-1 "," 3-2 "]," 4 ": [" 4 "," 4-1 "," 4-2 "] , "5": ["5", "5-1", "5-2"]}
Comparison result:, "1": ["1", "1-1", "1-2"],
Remark: This is very good writing. can achieve the effect of removing the nearest one]
2.0 Wide Assertion
(? =exp) match the position of the exp front
(? <=exp) matches the position of the exp rear
(?! EXP) match the position that follows not exp
(? <!exp) matches a position not previously exp
Regular examples:
(?<=< (\w+) >). * (?=<\/\1>)
Test data:
<li><a href= "#updatelog" > more new record </a></li>
Comparison results: <a href= "#updatelog" > more new record </a>
Remark: This is very good writing. Can take the beginning of the end, but can not be in <a>....</a> again in the case of <a>...</a>, fortunately HMTL in the <a> again appear <a>. If it's like Div, it has to be written in the following way.
<[^<>]* ((? ') Open ' < ' [^<>]*] + (? -open ' >) [^<>]*] +) * ( Open) (?!)) >
<div class= "Note" >aaa<div> other available test tools: </div>bbbb</div><div><a href= "www.*****.com ">gogogo</a></div>