簡體   English   中英

正則表達式查找沒有特殊字符的文本

[英]Regex to find the text without a special character

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

參見http://www.regular-expressions.info/lookaround.html#limitbehind

如果您還沒有的話,可以嘗試以下操作:

(?<!<font color='black'>)AVG(?!</font>)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM