正则表达式找到没有特殊字符的文本

时间:2012-10-16 04:47:35

标签: java regex

我有一个段落,其中一些文本被特定的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...

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

我如何使用Java?

1 个答案:

答案 0 :(得分:1)

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

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

(?<!<font color='black'>)AVG(?!</font>)
相关问题