第一 :
"
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^&;] # Match a single character NOT present in the list “&;”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
; # Match the character “;” literally
)
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
< # Match the character “<” literally
[^<>] # Match a single character NOT present in the list “<>”
* # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
)
"
Run Code Online (Sandbox Code Playgroud)
第二个 :
"
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^<>] # Match a single character NOT present in the list “<>”
* # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
> # Match the character “>” literally
)
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^&;] # Match a single character NOT present in the list “&;”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
; # Match the character “;” literally
)
"
Run Code Online (Sandbox Code Playgroud)
请注意,这两个表达式实际上根本不捕获任何内容,但它们可能用于精确定位字符串内的位置.没有任何上下文很难确切地说明它们的使用位置.