VSCode

VSCode中正则语法说明

  • 替换中引用搜索中的分组
    • 背景:搜索带分组
      • 写法:(xxx)
    • 语法:替换时引用对应分组,用:$N
      • N=1,2,3,...
    • 举例
      • 例子
        • 搜索:(\w+)\n
        • 替换:"$1",\n
  • 环视
    • 可以参考自己的教程
    • 核心要点和举例
      • (?=xxx): (positive) look ahead (assertion)=正向肯定断言
      • (?!xxx): negative look ahead (assertion)=正向否定断言
      • (?<=xxx): (positive) look behind (assertion)=反向肯定断言
        • 例子1:
          (?<!\s)<([\.\w]+)>
          &lt;$1&gt;
          
      • (?<!xxx): negative look behind (assertion)=反向否定断言
        • 例子1
          (?<!http\.)get\(
          
        • 例子2
          (?<!")15(?!")
          

results matching ""

    No results matching ""