我有这个例子:
<meta name="abstract" content="Moment, lovin, of, superman, | jonny, Deep, is"/>
我想从此标签中删除类似of,
或 的单词。is
结果应该是:
<meta name="abstract" content="Moment, lovin, superman, | jonny, Deep"/>
答案1
- Ctrl+H
- 找什么:
(?:<meta name="abstract" content="|\G)[^"]*?\K,\h+(?:is|of)\b
- 用。。。来代替:
LEAVE EMPTY
- 查看 相符
- 查看 环绕
- 查看 正则表达式
- Replace all
解释:
(?: # non capture group
<meta name="abstract" content=" # literally
| # OR
\G # restart from last match position
) # end group
[^"]*? # 0 or more non quote, not greedy
\K # forget all we have seen until this position
, # a comma
\h+ # 1 or more horizontal spaces
(?:is|of) # non capture group, is OR of
\b # word boundary
使用[a-zA-Z]{1,2}\b
它来(?:is|of)\b
删除所有长度为 1 或 2 个字符的单词。
截图(之前):
截图(之后):