简体   繁体   中英

Notepad++ regex / Excel macro to delete specific range of lines

I have data like follows:

  1. gooddata
  2. gooddata
  3. gooddata

FF

randomdata

irrelevantdata


headers


  1. gooddata

  2. gooddata

  3. gooddata

FF

and it goes on repeatedly for over thousands of lines. I have two proposed solution ideas

Notepad++

Create a regex to Find x criteria and delete subsequent of y number of lines

or

VBA

Find "FF" and delete everything until "---". find next "FF" and delete everything until next "---" .

So the output intended be like:

  1. gooddata
  2. gooddata
  3. gooddata
  4. gooddata
  5. gooddata
  6. gooddata

Thanks for your help.

You can do a regular expression replace in Notepad++.

Find : FF.*?\-\-\-
Replace with: (Blank Text)
Search Mode: Regular Expression
Check . Match New Lines checkbox

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM