(?=[^,]) ,其中?=如何理解?
http://www。
regular-expressions。info
/
Lookahead and lookbehind, collectively called “lookaround”, are zero-length assertions The difference is that lookaround actually matches characters, but then gives up the match, returning only the result: match or no match. They do not consume characters in the string, but only assert whether a match is possible or not. The regex q(?=u)i can never match anything. It tries to match u and i at the same position. If there is a u immediately after the q then the lookahead succeeds but then i fails to match u. If there is anything other than a u immediately after the q then the lookahead fails.
(?!) - negative lookahead
(?=) - positive lookahead (?=foo)bar —— 前面有foo的bar
(?<=) - positive lookbehind bar(?<=foo) —— 後面沒有foo的bar
(?>) - atomic group match first b match first b
上一篇:人性本私之借刀復仇01