notepad++ - 查找并连接多行中的行
问题描述
我想选择以 and 结尾的行<h2>
,</h2>
并希望加入这些行,如下所示:
现有文本:
<h2>
A musician's tattoo
</h2>
If you’ re a musician and would like tolket a tattoo, get a tattoo of your ...
<h2>
A zombie hare chest tattoo
</h2>
100/lO0.002.jpg
You won’ tsee this tattoo every day.
<h2>
Abby Name Tattoos
</h2>
For your little angels, a tattoo of their names will never be a mistake.
所需文字:
<h2> A musician's tattoo </h2>
If you’ re a musician and would like tolket a tattoo, get a tattoo of your ...
<h2> A zombie hare chest tattoo </h2>
100/lO0.002.jpg
You won’ tsee this tattoo every day.
<h2> Abby Name Tattoos </h2>
For your little angels, a tattoo of their names will never be a mistake.
我正在使用 RegEx <h2>*?.*?</h2>
,但只标记了一行。
解决方案
- Ctrl+H
- 找什么:
(<h2>)\R(.+)\R(.+)
- 用。。。来代替:
\1\2\3
- 检查环绕
- 检查正则表达式
- Replace all
解释:
(<h2>) : <h2> into group 1
\R : any kind of linebreak
(.+) : matches any character into group 2 (except for line terminators)
\R : any kind of linebreak
(.+) : matches any character into group 3 (except for line terminators)
如果您真的想在H2
文本前后插入空格,则必须\2
在替换为之前和之后执行此操作。对于干净的 HTML,这是没有意义的。
推荐阅读
- html - 如何在悬停时更改跨度 ID 文本?(CSS)
- javascript - 表单无效时停止向表单动态添加字段
- python - Python AttributeError:“序列”对象没有属性“序列”
- html - 使用容器流体在引导程序中填充
- sql - Oracle 返回 ORA-00904: 添加外键时出现无效标识符错误
- r - tidyverse:替换字符串中的特殊字符
- amazon-web-services - android中的aws-sdk反应本机设置
- swift - 为什么它在 SwiftUI 中总是说“无法将类型''的值转换为预期的参数类型''”
- fortran - 有没有办法显示我的代码的最后一部分?最后代码行的输出没有出现
- mysql - 在具有不同端口的不同容器上运行 mysql,“建立数据库连接时出错”