我有这个元标签
<meta name="keywords" content="Doing well is a great thing"/>
必须成为:
<meta name="keywords" content="doing, well, is, a, great, thing"/>
我尝试了这样的方法,但没有效果:
搜索:(<([^<meta name="keywords" content=>]+)>(.*?))
替换为:/1/2,
谁能帮我?
答案1
- Ctrl+H
- 找什么:
(?:<meta name="keywords" content="|\G)\w+\K\h+
- 替换为:
,
#逗号和空格 - 查看 环绕
- 查看 正则表达式
- Replace all
解释:
(?: # non capture group
<meta name="keywords" content=" # literally
| # OR
\G # restart from last match position
) # end group
\w+ # 1 or more word character
\K # forget all we have seen until this position
\h+ # 1 or more horizontal spaces
截图(之前):
截图(之后):