Community
    • Login

    Deleting multiple lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 6.3k 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.
    • Norson TeeferlyN
      Norson Teeferly
      last edited by

      I know it’s possible but I think I’m having a senior moment ( or brainfart) but I want to delete segments of code from <string> to </string> that spans multiple lines in lots of places with different text in the same file. This is from a game that publishes a discoveries file to help plugin makers find and use the appropriate itemID and itemNames within their plugin.

      For example:
      <FirstLearnedBy>
      <ServerNameA>AlphaShard</ServerName>
      <Player>JohnDoe</Player>
      <Guild>HomeBros</Guild>
      <Date>June 12, 2015</Date>
      <ServerNameB>BravoShard</ServerName>
      <Player>JaneWest</Player>
      <Guild>RealGirrrls</Guild>
      <Date>April 24, 2015</Date>
      </FirstLearnedBy>

      That goes on for about 60-72 lines and spams the file. I obviously don’t need it for my addon but sitting here deleting each section takes ages in a 500,000+ file for every recipe in the game. I’m also deleting the non-English translations of each recipe and material used.

      Thanks in advance for any help.

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • young-developerY
        young-developer
        last edited by

        @Norson-Teeferly I think you could use regex in Find/Replace form. You could try/learn regex - http://regexr.com/

        1 Reply Last reply Reply Quote 0
        • Scott SumnerS
          Scott Sumner @Norson Teeferly
          last edited by

          @Norson-Teeferly

          So for what you’ve specified, the following should work:

          Find what: (?s)<FirstLearnedBy>.+?</FirstLearnedBy>
          Replace with: make sure this box is empty
          Search mode: Regular expression

          1 Reply Last reply Reply Quote 0
          • Norson TeeferlyN
            Norson Teeferly
            last edited by

            That did the trick. Thank you.

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