notepad++ - 我如何搜索特定文本然后从搜索行的开头到行尾以替换为“”
问题描述
SkinMesh
{
skin = "Art/Models/Effects/monster_effects/League_Affliction/affliction_demon_lightning/lightning_warp/geo.sm"
}
ParticleEffects
{
animation = "start"
0 = "midline Metadata/Particles/monster_effects/League_Affliction/affliction_demon_lightning/lightning_warp/marker_start.pet"
animation = "loop"
0 = "midline Metadata/Particles/monster_effects/League_Affliction/affliction_demon_lightning/lightning_warp/marker_loop.pet"
tick_when_not_visible = true
}
我想从搜索/替换中得到的是这个
SkinMesh
{
}
ParticlesEffects
{
}
解决方案
- Ctrl+H
- 找什么:
(?:SkinMesh|ParticleEffects)\s+{\K.+?(?=\R})
- 用。。。来代替:
LEAVE EMPTY
- 检查 环绕
- CHECK 正则表达式
- 查看
. matches newline
- Replace all
解释:
(?: # non capture group
SkinMesh # literally
| # OR
ParticleEffects # literally
) # end group
\s+ # 1 or more spaces
{ # opening brace
\K # forget all we have seen until this position
.+? # 1 or more any character, not greedy
(?=\R}) # positive lookahead, make sure we have a linebreak and a closing brace after
截图(之前):
截图(之后):
推荐阅读
- mysql - 如何使用 Sequelize 添加外键和级联属性?
- python - 修补单元测试中的单个类方法并断言它被调用一次
- python - 卡恩算法的顺序不正确
- html - 设置类型为 number 的 Input 字段所需的确切元素数量
- rest - Delphi:带有基本身份验证的 REST 请求
- security - 使用 Iptables 进行暴力登录预防
- python - 更新表单后没有保存任何内容
- ios - 在文本字段上强制使用英文键盘
- javascript - 如何在js中的map函数中填充数组并将其发送到服务器?
- php - 如何将 .htaccess 重写规则更改为 web.config