arraysregexvisual-studio-codereplace

What is the Regular Expression syntax to select the text after the match, using Visual Studio Code Find&Replace


I have rewritten this question to hopefully make it more clear what I need.

I an configuring some files. I want to clear an array in multiple files. The array is labeled the same across all files, but has different contents in some files.

I need to select the contents of the array, so I can get rid of the contents.

The closest I have come to solving this is to use the regular expression ("incompatible": )+\[+\n

I am stuck on what the syntax is to to select a variable amount of characters after this.

Additional info:

  1. The array is at the bottom of all text files, and always ends in a ]
  2. The files are .json
  3. I am using the Visual Studio Code Find&Replace function.

Edit: Answered by rioV8, thank you!


Solution

  • Perform a regex Find/Replace in files with

    Find: (?<="incompatible": \[)(\r|\n|[^\]])+

    Replace: empty string