I work with Canvas in a middle school and am constructing quizzes which contain a question type called "fill-in-the-blank". A grading option for this type of question is to compare what the student typed in to a regex. The Quiz settings only allow me to enter a single regex and if the input matches the question is counted as correct. This is simple to do for single or few word answers. But I would like to ask something like, "list three different examples of environmental stimuli, ended with a period". So a correct input string might be the following:
rain. bright sunlight. a dog's bark.
but an incorrect input string would be:
water. water. a bicycle.
I can match individual phrases and split them using ([\w\s']*[^\.]?)
. This yields three matches in a regex tester. But I need to go further.
I need to check each phrase for a keyword, and then check if that keyword has been used before. Essentially, I need to match an alternation group without repetitions using a single regex pattern. Can this be done?