Community
    • Login

    Deleting specific amount of lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 168 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.
    • Nuke WarriorN
      Nuke Warrior
      last edited by

      Hi everyone, I was wondering if npp++ is able to remove specific line amounts. For an example, I’m writing in a code that relies on removing things, here’s the example

      Prerequisites
      Object = AmericaWarFactory
      Object = AmericaStrategyCenter
      End

      What I want to achieve is basically a layout where it starts from Prerequisites to End, I want to remove those. however the situation is the End Keyword. In my text files, there are multiple ends, because what comes with that quote is

      Prerequisites
      Object = AmericaWarFactory
      Object = AmericaStrategyCenter
      End

      ExperienceValue = 75 100 125 150 ;Experience point value at each level
      ExperienceRequired = 0 200 437 750 ;Experience points needed to gain each level
      IsTrainable = Yes ;Can gain experience

      WeaponSet
      Conditions = None
      Weapon = PRIMARY TomahawkMissileWeapon
      End

      I basically only want the code to focus on the Prerequisite to the very next end line, so the outcome achieved will end up looking like this

      ExperienceValue = 75 100 125 150 ;Experience point value at each level
      ExperienceRequired = 0 200 437 750 ;Experience points needed to gain each level
      IsTrainable = Yes ;Can gain experience

      WeaponSet
      Conditions = None
      Weapon = PRIMARY TomahawkMissileWeapon
      End
      Is this possible at all?

      astrosofistaA 1 Reply Last reply Reply Quote 0
      • astrosofistaA
        astrosofista @Nuke Warrior
        last edited by

        Hi @Nuke-Warrior

        Yes, I think it’s possible. Try the following regex:

        Find: (?s)^Prerequisites.*?End\R+
        

        Leave the replace field empty.

        Have fun!

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