Search code examples
regexsearchnotepad++

Notepad++ Regex Search XML argument for anything but certain word


I have a well structured XML file with several grouped units, which contain a consistent number of child elements.

I am trying to find a way, through Regex in Notepad++, to search throughout all of these groups for a certain argument that contains a single word. I have found a way of doing this but the problem is I want to find the negation of this word, that means for instance, if the word is "downward" I want to find anything that is NOT "downward".

Here is an example:

<xml:jus id="84" trek="spanned" place="downward">

I've came up with <xml:jus id="\d+" trek="[\w]*" place="\<downward"> to find these tags, but I need to find all other matches that do not have "downward" in place= argument. I tried <xml:jus id="\d+" trek="[\w]*" place="^\<downward"> but without success.

Any help is appreciated.


Solution

  • You might be able to use a negative lookahead to exclude downward from being the place:

    <[^>]+ place="(?!downward").*?"[^>]*>
    

    Demo