Deleting multiple lines



  • 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.



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



  • @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



  • That did the trick. Thank you.


Log in to reply