I have a text that has many questions and each question has a seperator QId
{QuestionId}.
Now I want to split this text with QId
{QuestionId} to get a dictionary with keys as {QuestionId} and the question body as a Value. Here questionId
is dynamic will have any Integer value.
I have tried this Regex.Split
with regex "\\s*QId\\s*[\\d]+\\s*\\s*"
.
I can get the question body but I want Question Id, too, as a Key so I can do some action based on QuestionId.
I have tried below code:
Regex.Split(
text, string.Format("\\s*{0}\\s*[\\d]+\\s*\\s*",
"QID"), RegexOptions.Singleline);
It did not give me data in dictionary.
`? – tymtam Jan 05 '23 at 10:22