fixed multiline regex

This commit is contained in:
2024-03-29 14:34:38 -06:00
parent 035c46b284
commit a9cf38ecf2
4 changed files with 26 additions and 6 deletions

View File

@@ -30,7 +30,12 @@ public record LocalQuizQuestionAnswer
}
string startingQuestionPattern = @"^(\*?[a-z]?\))|\[\s*\]|\[\*\]|\^ ";
var text = Regex.Replace(input, startingQuestionPattern, string.Empty).Trim();
int replaceCount = 0;
var text = Regex.Replace(input, startingQuestionPattern, (m) =>
{
return replaceCount++ == 0 ? "" : m.Value;
}).Trim();
return new LocalQuizQuestionAnswer()
{
Correct = isCorrect,