我必须从标签中删除所有逗号(而不是从整个 html 文件中删除):
<!DOCTYPE, html>
<html, xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="ro">
<title>I, love, Myself, Now | Nick, Francisco</title>
<meta, property="fb:admins", content="1446157242"/>
<link, rel="sitemap" type="application/rss+xml" href="rss.xml" />
<meta, name="googlebot" content="index,follow"/>
<link, rel="shortcut, icon" href="goiu.ico"/>
<meta, http-equiv="X-UA-Compatible" content="IE=edge,"/>
我制作了一个正则表达式,但不太好。
寻找:(?-s)(\G(?!^)|<,)((?!/>).)*?\K\s\s+
替换为:(leave empty)
答案1
- Ctrl+H
- 找什么:
(?:<\w+|\G)(?:(?!>).)*?\K,
- 用。。。来代替:
LEAVE EMPTY
- 查看 环绕
- 查看 正则表达式
- 取消选中
. matches newline
- Replace all
解释:
(?: # non capture group
< # <
\w+ # 1 or more word characters
| # OR
\G # restart from last match position
) # end group
(?: # non capture group
(?!>) # negative lookahead, make sure we haven't ">" character after
. # any character but newline
)*? # end group, may appear 0 or more times, not greedy
\K # forget all we have seen until this position
, # a comma
截图(之前):
截图(之后):