Community
    • Login

    Deleting specific amount of lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 356 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 Offline
      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 Offline
        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

        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