trying to delet a bunch of lines

  •                             "north": {"uv": [4.875, 0.25, 8.375, 3.375], "texture": "#missing"},
    			"east": {"uv": [7.875, 11.875, 16, 16], "texture": "#missing"},
    			"south": {"uv": [4.875, 0.5, 7.75, 3.25], "texture": "#missing"},
    			"west": {"uv": [7.875, 11.875, 8.375, 12.125], "texture": "#missing"},
    			"up": {"uv": [2.5, 0, 10.625, 4.125], "rotation": 270, "texture": "#missing"},
    			"down": {"uv": [2.5, 0, 10.625, 4.125], "rotation": 270, "texture": "#missing"}

    trying to delete lines that have these in them.
    “north”: {“uv”: [ x,x ,x ,x ], “texture”: “#missing”},
    the x will be diffrent all the time

  • Hello, @speedrider and All,

    Just use the following regex S/R :

    SEARCH (?-s)^\h*"north": \{"uv": \[.+], "texture": "#missing"},\R


    Notes :

    • First, the in-line modifier (?-s) forces the regex engine to consider any regex dot symbol ( . ) to match a single standard char only and not any EOL char

    • Then, from beginning of line ( ^ ), possibly followed with horizontal blanks chars, as Tab, Space ( \h* ),

    • It tries to match the string “north”: {“uv”: [, with the regex part "north": \{"uv": \[.

    • Note that the special opening regex symbols {, beginning a quantifier and [, beginning a character class, must be escaped, as \{ and \[, to be interpreted as literals !

    • It also tries to match the string ], “texture”: “#missing”}, and its line-break, with the final regex part ], "texture": "#missing"},\R

    • With any non-null range of characters .+ between these two strings

    • As the replacement zone is empty , any current line matched, with its line-break, is then deleted

    Best Regards,


  • @guy038 said in trying to delet a bunch of lines:

    (?-s)^\h*“north”: {“uv”: [.+], “texture”: “#missing”},\R

    (?-s)^\h*"north": \{"uv": [.+], "texture": "#missing"},\R
                                  ^                       ^

    Interesting to note that the characters indicated above don’t need to be escaped, but only a true regex god would remember this, and mere mortals would probably escape them thusly:

    (?-s)^\h*"north": \{"uv": [.+], "texture": "#missing"\},\R
                                  ^^                       ^^

  • Hi, @alan-kilborn and All,

    Indeed, as noticed, below, in the Special characters section :

    There are only 12 special regex characters and, both, the closing square bracket ] and the closing curly bracket } are not part of this set !



Log in to reply