Deleting specific amount of lines
-
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
EndWhat 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
EndExperienceValue = 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 experienceWeaponSet
Conditions = None
Weapon = PRIMARY TomahawkMissileWeapon
EndI 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 experienceWeaponSet
Conditions = None
Weapon = PRIMARY TomahawkMissileWeapon
End
Is this possible at all? -
Yes, I think it’s possible. Try the following regex:
Find: (?s)^Prerequisites.*?End\R+
Leave the
replace
field empty.Have fun!