Extract text from Text file 2

Hi all,

I’m facing issue in extracting text from this text file.

Sample20231109-5L (2).zip (3.7 KB)

There is sample code in that present I’m able to extract question and answer.
Now i want to extract the options also can anyone help me. I need this like 1 by 1 .
First question then options 1 by 1 and in last solution

Below regex i tried but not getting any output.

System.text.regularexpressions.regex.matches(my variable,“(?\d+. .+?)/n/s*(a).+?\n\sb).+?\n\sc).+?\n\sd).+?)\n\sanswer\s*(?[a-d])”).


can you help me on this. The attached code is which you have sent yesterday. If you get time please check once.

Hi @Beginner1234

Could you share the sample output that you are expecting for the given input data?

Best Regards.

@arjunshenoy can you open the zipfile you will find a text file called DATA. In that there are questions and options i need it 1 by 1 like first question then options 1 by 1 then answer. Following this i need it for all questions in that text file

@Yoichi can you look into this once


How about the following?

Sample20231109-5LV3.zip (4.3 KB)


1 Like

Thanks @Yoichi this is perfect.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.