Community
    • Login

    Deleting multiple lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 6.7k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            Norson Teeferly
            last edited by

            That did the trick. Thank you.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors