I am having a difficult time with finding and separating certain regular expressions in Powershell. I have an example of the following contents of the text file that I need to search in the link below. Beneath each question is the response.
I need to find the response to each question and just store it in an excel file. It is possible that the questions might be in a different order in the text file so I need to be able to extract the correct responses to their respective questions.
I can extract the questions by doing
$question1 = $file | Where-Object { $_.Contains("Name") }
$question2 = $file | Where-Object { $_.Contains("Are you feeling ok?") }
$question3 = $file | Where-Object { $_.Contains("Did you do your homework?") }
$question4 = $file | Where-Object { $_.Contains("List your favourite subjects?") }
I am having difficulty with extracting the response right underneath it (because the questions could be in any order. In the future there could be more questions in the text file).
