首页 > 解决方案 > 我如何搜索特定文本然后从搜索行的开头到行尾以替换为“”

问题描述

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
{
}

标签: notepad++

解决方案


  • 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

截图(之前):

在此处输入图像描述

截图(之后):

在此处输入图像描述


推荐阅读