-1

I am very new to regular expressions and I have some 20k lines in a text file following a specific format. Example below

  To:  1234@abc.com
  From: 5678@abc.com
  Message-info: hshjsjsjjsjdjdjsjjsj
  Subject: email regarding
                   Your new house

I need ‘To: ‘ and ‘Subject:’ lines to be copy and pasted a new editor.

I have used ‘bookmark lines’ option in notepad++ for both To and Subject separately but the total number is not matching. Any help would be appreciated

ckp
  • 579
  • 2
  • 10
  • 27
  • I recommend [this link](https://stackoverflow.com/questions/2116328/regexp-matching-string-not-starting-with-my), and use search and replace everything NOT matching your regex with NOTHING (empty string) .... (basically Notepad++ regex should word like "regular" regex :-) – St3an Apr 23 '18 at 15:34

1 Answers1

0

It seems like there is 2 space characters at the beginning of each line. Try using regex:

^  (?!To:|Subject:).*$\r*\n*

and replace it with nothing (empty string)

Demo

Matt.G
  • 3,586
  • 2
  • 10
  • 23