如何在记事本++中删除第一行包含“{”和第二行包含“}”的行?

How to delete lines that contains "{" in first line and "}" in second in notepad++?

我有这个代码:

.class {
}

我想删除整个文件中的这些行(它有 6k 行长)。 我该怎么做?

  • Ctrl+H
  • 查找内容:^[^{\r\n]+\{\R\}
  • 替换为:EMPTY
  • 全部替换

确保您已检查 Regular expression

解释:

^           : start of string
  [^{\r\n]+ : 1 or more character that is not left curly brace or line break
  \{        : left curly brace, must be escape as it is a special character
  \R        : any kind of line break
  \}        : right curly brace, must be escape as it is a special character