Use a tempered greedy token regex:<a>(?:(?!<(?:b>BB|/?a>)).)*</a>启用 .匹配换行符选项.Enable the . matches newline option. 详细信息: <a>-文字<a>字符序列 (?:(?!<(?:b>BB|/?a>)).)*-与任何字符(.)匹配的脾气暴躁的令牌,该字符不是可以与(?!<(?:b>BB|/?a>))前瞻(不是<b>BB或或<a>序列) </a>-文字</a>字符序列<a> - a literal <a> char sequence(?:(?!<(?:b>BB|/?a>)).)* - a tempered greedy token matching any char (.) that is not the starting symbol of a sequence that can be matched with the pattern inside the (?!<(?:b>BB|/?a>)) lookahead (not a <b>BB or </a> or <a> sequence)</a> - a literal </a> char sequence 这篇关于如果找不到给定的文本,则匹配正则表达式,并尽可能少地匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-26 22:19