brightspace regular expression header

Use Quiz Answer Variations in Brightspace

Multiple choice questions are fantastic for the ease of autograding in Brightspace. But did you know you can create a answer set to autograde as well? It is a little more work up front but it opens up the door to more robust questions without manual grading.

We can do this using regular expressions. These are special characters that tell Brightspace to compare the answer given by a student to set of acceptable answers.

A similar example you might be familiar with is searching Google. If I use search ~inexpensive, Google will bring me search results for “inexpensive” and other synonyms like “cheap”, “affordable”, or “low cost”. With just an added special character (~), I asked Google to search a whole set of synonyms.

Regular expressions work for short answer, multi-short answer, arithmetic, significant figures, and fill in the blanks questions.

Examples of regular expressions for quizzes

Here is an example of a regular expression and the set of answers that match. If the student types in any of the matching answers, the question is marked correct.

Question: What is the month and day of U.S. Independence Day?

Regular expression: July (fourth|4|4th)

  • Matching answers:
  • July fourth
  • July 4
  • July 4th

Other examples

For a very simple example like this, you could just type both choices into the answer box of Brightspace. But these same symbols can be used with others to create a more advanced regular expression.

Regular expression: [C|c]at

  • Cat
  • cat

Regular expression: (|they(‘| a)re )colou?rs

  • colors
  • colours
  • they’re colors
  • they’re colours
  • they are colors
  • they are colours

This longer more advanced expression is from Perdue.edu. This is where you can really see the advantages of regular expressions.

Regular expression: (\s*singleVal\s*=\s*matrixA\s*[(]\s*3\s*[,]\s*2\s*[)]\s*(;?)\s*)

  • singleVal = matrixA(3,2);
  • singleVal=matrixA(3,2);
  • singleVal = matrixA ( 3 , 2 ) ;
  • singleVal = matrixA(3,2)
  • etc.

How to use regular expressions in Brightspace Quizzes

Now you can reference the possible regular expression characters to create your own regular expressions. There are endless possibilities to match any quiz question topic.

To use a regular expression in a Brightspace Quiz, choose “Regular expression” from the dropdown menu next to the quiz field where you would normal enter the question answer. Then enter your regular expression in the answer field.

Any answer that matches the regular expression will be marked as correct when the Brightspace Quiz is automatically graded. We suggest you test the quiz to make sure everything is working as it should.

brightspace quiz regular expression

Watch the video below for a walkthrough of the complete process.

Regular expression characters

To see all the regular expression characters with descriptions and examples, head over to this Brightspace documentation page. There are 43 different expressions so we won’t list them all here.

Testing the expressions

Once you have created a regular expression, you can use the Regex101 website to test answer choices.

  1. Add your regular expression field labelled “Regular Expression”
  2. Add possible answers to the “Test String” field, one per line
  3. Check the match information in the right column to see if the possible answers match. Matches will also be highlighted in blue.
regex101 regular expression testing site screenshots

Give it a try to take full advantage of Brightspace’s grading features. If you have questions, please contact the IDAT team.

%d bloggers like this: