1

I got some questions saved as .txt file. I want to remove all question numbers and a line break from it's options and put a TAB space with the question. Like a QUESTION<tab_space>OPTION1<tab_space>OPTION2<tab_space>OPTION3<tab_space>OPTION4 then a line break and next question things.

my text file is looks like:

11. Lungs are located in the
A) abdominal cavity
B) pericardial cavity
C) peritoneal cavity 
D) pleural cavity
12. Which one of the following is the ideal food for newborn babies?
A) Water
C) Honey
B) Sugar
D) Milk
13. Transcription means the synthesis of
A) Lipids
C) DNA
B) Protein
D) RNA

how do I want this is:

Lungs are located in the    abdominal cavity    pericardial cavity  peritoneal cavity   pleural cavity
Which one of the following is the ideal food for newborn babies?    Water   Honey   Sugar   Milk
Transcription means the synthesis of    Lipids  DNA Protein RNA

Am doing this is because, I can then just copy all and paste on EXCEL document, where TAB recognize as next row and LINE_BREAK recognize as next column. Easy copying for me. I just to know how to replace words with notepad, don't know how to remove a line break or those numbers end with a dot (.)

My Aim:

  1. Remove all line breaks

  2. Replace all numbers with a dot(.) at end with a line break [11.]

  3. Replace [A-D] with ')' with a TAB space

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

We can do this with two replacements:

Find: (?:^|(?<=\n))\d+\.
Replace: (empty)

Demo

Find: (?:^|\r?\n)[A-Z]+\)
Replace: \t

Demo

And here is a Java demo showing that the replacement is working.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360