I have a string which looks like this :
Q 1. What is your age?
Ans. 15.
Q 2. What is your name?
Ans. My name is Bond.
My full name is James Bond
Q 3. What is your favorite subject?
and so on... The answers can have multiple paragraphs. The text generally looks like and so on.. I am trying to write a regex which gives me these pairs. I want to separate out the question answer pairs. I have a regex which outputs the questions but am unable to figure out how to get the pairs? Please guide. The regex for questions is :
p = re.findall("""Q [0-9]+[a-zA-Z]*\.(.*?)Ans\.""", checkText, re.S)