How to delete 270 lines?

General questions about using WildEdit

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
grevesz
Posts: 6
Joined: Tue May 17, 2005 10:42 pm

How to delete 270 lines?

Post by grevesz »

Hello,

What is the regular expression to find and delete 270 lines (no matter what the content) starting at a line that follows a certain expression?

Example:
If the expression is APPLE and its first occurrence is on line 500 (doesn't matter if there are other characters in that line or not), then I want to delete lines 501-770 (270 lines starting with the following line).

Thanks in advance!

Gabor
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

The Regex would be:

Code: Select all

.*APPLE(.*\n){270}
Make sure the ". matches end of line" modifier is OFF.

(Note: this expression does NOT work in Textpad)
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

The OP wants to keep the line with APPLE on it. And I believe you have to handle Windows line endings (CR,LF) explicitly.
Search for: (.*APPLE.*\r?\n)(.*\r?\n){270}

[X] Regular expression
[ ] "." matches end of line characters [i.e., not selected]

Replace with: $0

[ ] Literal replacement [i.e., not selected]
grevesz
Posts: 6
Joined: Tue May 17, 2005 10:42 pm

Post by grevesz »

Thanks!
:D

Gabor
Post Reply