Regular Expression

Last modified by Carina Enke on 22.01.2024

 

Icon_Regulärer Ausdruck.png The task type "Regular expression" is an extension of the text entry interaction with a specific form of assessment. The solution set is not determined by fixed values or alternative solutions in this task type, but rather by a regular expression (string). This expression describes valid solution sets of the task.

commercial.pngA licence is required to use this question type.

Beispiel Regulärer Ausdruck.jpg

As a solution to the task, the input of a string is expected which fulfils the conditions of the regular expression and is therefore part of the solution set. The regular expression is assessed using the pattern implementation contained in JAVA: https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html

 

Define questions and answers

Enter the question in the input field. The gaps for the solution input can be defined within the text. Any number of gaps can be created. A more detailed description of how to create a gap can be found in the help section Text entry interaction.

Step by step

In the following, the creation of a task of the type regular expression is explained by means of an example.

1.  Step: Design the task

A variable of the type integer is to be correctly defined in the language C. The learner is expected to enter an example of such a variable in the gap.

2.  Step: Create the question

In the tab "Question & Answer", enter the question in the text field.

Click on the gap symbol Icon_Lücke.png or create a new gap via the button Add gap .

Regulärer Ausdruck Aufgabe erstellen.png

3.  Step: Specify the regular expression and optional solution hint

Under Edit gap , you can optionally enter a sample answer or another text in the field Solution hint . The hint is displayed if the user submits an answer which does not lie within the value range of the defined regular expression.

Regulärer Ausdruck Einstellungen zur Luecke.png

In the text field Regular expression , you can define the value range of the expected solution. Backreferences within the expression are supported by the system.

All other fields and areas can be configured as described in the section Text entry interaction.