1

我有一个段落,其中一些文本被特定的 html 标签包围。我需要找到未被该特定 html 标记包围的文本。例如

AVG Antivirus for Smartphones and Tablets detects harmful apps and SMS. 

<font color='black'>AVG</font> Mobilation™ AntiVirus Pro for Android™ is a mobile security 

solution that helps protect your mobile device from viruses, malware, spyware and online 

exploitation in real-time. avg blah blah...

我想找到不被 . 包围的单词 AVG(不区分大小写)<font color='black'> </font>。它可以是单词的一部分,也可以是单个的整个单词。在部分文本的情况下,包含单词 AVG 的整个单词不应被该 html 标记包围

我怎么能用Java做到这一点?

4

1 回答 1

1

请参阅http://www.regular-expressions.info/lookaround.html#limitbehind

如果您还没有,您可以尝试以下操作:-

(?<!<font color='black'>)AVG(?!</font>)
于 2012-10-16T04:58:43.690 回答