Notepad++ 如果行包含其他字符,则在行的开头插入字符(如制表符):记事本++;

Notepad++ 如果行包含其他字符,则在行的开头插入字符(如制表符):记事本++;,notepad++,Notepad++,我想在行的开头插入一个字符,但前提是特定行包含一个符号 例如,如果行至少包含一个,则在行的开头添加\t符号 我已经搜索了regex功能,因此很明显我能够在每行的开头添加一个\t,但只有当该行包含带有regex的符号时才能插入条件 Ctrl+H 查找内容:^(?=.*) 替换为:\t 检查环绕 检查正则表达式 取消选中。匹配换行符 全部替换 说明: ^ # beginning of line (?= # positive lookahead,

我想在行的开头插入一个字符,但前提是特定行包含一个符号

例如,如果行至少包含一个
,则在行的开头添加
\t
符号

我已经搜索了regex功能,因此很明显我能够在每行的开头添加一个
\t
,但只有当该行包含带有regex的符号时才能插入条件
  • Ctrl+H
  • 查找内容:
    ^(?=.*)
  • 替换为:
    \t
  • 检查环绕
  • 检查正则表达式
  • 取消选中
    。匹配换行符
  • 全部替换
  • 说明:

    ^               # beginning of line
      (?=           # positive lookahead, make sure we have after:
        .*          # 0 or more any character but newline
        ;           # semicolon
      )             # end lookahead
    
    屏幕截图(之前):

    ^               # beginning of line
      (?=           # positive lookahead, make sure we have after:
        .*          # 0 or more any character but newline
        ;           # semicolon
      )             # end lookahead
    

    屏幕截图(之后):

    ^               # beginning of line
      (?=           # positive lookahead, make sure we have after:
        .*          # 0 or more any character but newline
        ;           # semicolon
      )             # end lookahead