我想找到所有带有特定标签但不包含特定单词的行。例如我想找到这一行:
<p class="text_obisnuit"><span class="text_obisnuit2"> I love You </span>blah blah blah</p>
而不是那些带有标签的行* Note:
,例如:
<p class="text_obisnuit"><span class="text_obisnuit2"> * Note: </span> blah blah </p>
因此,第一个例子应该是输出。
答案1
- Ctrl+F
- 找什么:
<p class="text_obisnuit"><span class="text_obisnuit2">(?! \* Note:.*?</span>).*?</span>.*?</p>
- 查看 环绕
- 查看 正则表达式
- 取消选中
. matches newline
- Find Next 或者
- Find All in Current Document
解释:
<p class="text_obisnuit"> # literally
<span class="text_obisnuit2"> # literally
(?! \* Note:.*?</span>) # negative lookahead, make sure we haven't " * Note:" before closing "</span>"
.*? # 0 or more any character, not greedy
</span> # end tag
.*? # 0 or more any character, not greedy
</p> # end tag