How can i filter files which does not have current piece of code? Using VSC

Viewed 14

i'm working with hunderts of files. Every file must include this piece of code. I know how to find files which have it included. How can i reverse it please? I use VSC

<p class="travelingRules">
  Podmínky cestování do
  <a
    href="https://www.mzv.cz/jnp/cz/encyklopedie_statu/evropa/recko/cestovani/index.html"
    title="Podmínky pro cestování do Řecka"
    target="_blank"
    ><b>Řecka</b></a
  >.
</p>
1 Answers

You can do it with this search:

Find:

(?<!\n)^(?![\s\S]*<p class="travelingRules">
  Podmínky cestování do
  <a
    href="https://www.mzv.cz/jnp/cz/encyklopedie_statu/evropa/recko/cestovani/index.html"
    title="Podmínky pro cestování do Řecka"
    target="_blank"
    ><b>Řecka</b></a
  >.
</p>)

(?<!\n)^ get the very first position in the file.

(?![\s\S]*...... a negative lookahead that will look at every character position for the following text - you can just copy and paste your text in the search across files find input after (?<!\n)^(?![\s\S]*. Only files that do not have that following text will be found.

No doubt performance is quite bad as I assume it goes character by character to see if the following is a match for your pasted text. You will have to see if performance is a problem in your specific case.

Related