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
How to delete 270 lines?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
The Regex would be:
Make sure the ". matches end of line" modifier is OFF.
(Note: this expression does NOT work in Textpad)
Code: Select all
.*APPLE(.*\n){270}
(Note: this expression does NOT work in Textpad)
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
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]