Community
    • Login

    trying to delet a bunch of lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 294 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SpeedRiderS
      SpeedRider
      last edited by

                                  "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

      1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        Hello, @speedrider and All,

        Just use the following regex S/R :

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

        REPlACE Leave EMPTY

        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

        Alan KilbornA 1 Reply Last reply Reply Quote 3
        • Alan KilbornA
          Alan Kilborn @guy038
          last edited by

          @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
                                        ^^                       ^^
          
          1 Reply Last reply Reply Quote 2
          • guy038G
            guy038
            last edited by guy038

            Hi, @alan-kilborn and All,

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

            https://www.regular-expressions.info/characters.html

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

            Cheers,

            guy038

            1 Reply Last reply Reply Quote 3
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors