<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/38/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rezeau</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/38/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rezeau"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/Special:Contributions/Rezeau"/>
	<updated>2026-04-18T00:48:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Editing_Questionnaire_questions&amp;diff=137006</id>
		<title>Editing Questionnaire questions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Editing_Questionnaire_questions&amp;diff=137006"/>
		<updated>2020-05-14T08:04:32Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Possible answers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questionnaire}}&lt;br /&gt;
&lt;br /&gt;
==Editing questions==&lt;br /&gt;
* On the Questionnaire &#039;&#039;&#039;Editing Questions&#039;&#039;&#039; page is displayed a drop-down list of the question types available and a list of the questions already created for the current questionnaire instance (if any).&lt;br /&gt;
* Using the standard Moodle icons you can change the order of the questions in the questionnaire, edit or delete questions.&lt;br /&gt;
&lt;br /&gt;
==Common options==&lt;br /&gt;
===Question Name===&lt;br /&gt;
&lt;br /&gt;
====Questionnaires &#039;&#039;&#039;not&#039;&#039;&#039; using the Conditional Branching or the Personality Test features====&lt;br /&gt;
&lt;br /&gt;
You can &#039;&#039;optionally&#039;&#039; enter a &#039;&#039;&#039;Question Name&#039;&#039;&#039; for each question.&lt;br /&gt;
&lt;br /&gt;
If your questionnaire does not use the &amp;quot;Conditional Branching&amp;quot; or the &amp;quot;Personality Test&amp;quot; feature, the &#039;&#039;&#039;Question Name&#039;&#039;&#039; is only used when you export responses to CSV/Excel format. If you never export to CSV, then you needn&#039;t worry about Question names. If you plan to regularly export your questionnaire data to CSV, then you have a choice of two options for question naming.&lt;br /&gt;
&lt;br /&gt;
=====Option 1: significant names=====&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Question Name &#039;&#039;&#039; box, enter &#039;&#039;meaningful&#039;&#039;, &#039;&#039;short&#039;&#039; and &#039;&#039;&#039;&#039;&#039;different&#039;&#039;&#039;&#039;&#039; question names for all of the questions within one questionnaire. In the CSV export file, all those question names will be prefixed with the question&#039;s actual number (= position) in the quiz. Examples:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | question number (position) in the questionnaire&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | question name entered by teacher&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | field header in csv export&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;5&amp;lt;/div&amp;gt;&lt;br /&gt;
| favorite colors&lt;br /&gt;
| Q05_favorite colors&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;6&amp;lt;/div&amp;gt;&lt;br /&gt;
| why_use_Moodle&lt;br /&gt;
| Q06_why_use_moodle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;7&amp;lt;/div&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
user-friendliness&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; (rate question with 3 possible answers: Moodle, WebCT and Blackboard) &#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
Q07_user-friendliness-&amp;gt;Moodle&amp;lt;br /&amp;gt; Q07_user-friendliness-&amp;gt;WebCT&amp;lt;br /&amp;gt; Q07_user-friendliness-&amp;gt;Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Option 2: leave the Question Name boxes blank=====&lt;br /&gt;
&lt;br /&gt;
For each un-named question, CSV export will automatically generate a question name. This is required for table header fields in the CSV and subsequent Excel tables or any statistics package you might be using. The question name generated will be based on the question number in the actual Quiz (excluding &#039;&#039;Section Text&#039;&#039; pseudo-questions, of course) e.g. Q01, Q02, ... Q99. For questions with multiple answers, such as rate-type or Likert type questions, a sub-question number will be generated (Q02_1, Q02_2, Q02_3, etc.). This type of &amp;quot;short-name&amp;quot; naming scheme is advisable for exporting your data to a statistics software. Of course, it&#039;s up to you to have your own system for remembering which abbreviated question name corresponds to which question in your questionnaire!&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | question number (position) in the questionnaire&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | question name entered by teacher&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | field header in csv export&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;5&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
| Q05&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;6&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
| Q06&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;7&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
|&lt;br /&gt;
Q07_1&amp;lt;br /&amp;gt; Q07_2&amp;lt;br /&amp;gt; Q07_3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is quite possible (but maybe not advisable) to mix the two systems, and have within one questionnaire both named and un-named questions.&lt;br /&gt;
&lt;br /&gt;
====Questionnaires using the Conditional Branching feature====&lt;br /&gt;
&lt;br /&gt;
If you need a question to be used as the &amp;quot;parent&amp;quot; of one or more subsequent questions in your questionnaire, then you &#039;&#039;&#039;must&#039;&#039;&#039; name that &amp;quot;parent question&amp;quot;. Only those (radio buttons, dropdown list or yes/no) questions with a &#039;&#039;name&#039;&#039; will appear in the Parent question dropdown list when adding a new question, as shown on the following screenshots.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-26-11.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-34-55.jpg]]&lt;br /&gt;
&lt;br /&gt;
For more information, see [[Questionnaire_Conditional_branching|Conditional branching]].&lt;br /&gt;
&lt;br /&gt;
===Response Required===&lt;br /&gt;
If you select &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039;, response to this question will be required, i.e. the respondent will not be able to submit the questionnaire until this question has been answered. If the respondent tries to submit a questionnaire with unanswered required questions (or, in the case of a questionnaire with more than one section, to go to the next page), a warning message will be displayed with a list of all the missing &#039;&#039;required &#039;&#039;questions in the questionnaire (or on the actual page).&lt;br /&gt;
&lt;br /&gt;
Default.- &#039;&#039;&#039;&#039;&#039;No&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;.- When you create new questions in sequence (one after the other), this parameter is carried over to subsequent questions. E.g. if you create question #1 with &#039;&#039;&#039;Response Required&#039;&#039;&#039; = &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039;, then the &#039;&#039;&#039;Response Required&#039;&#039;&#039; parameter will be pre-set to &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039; for question #2, etc. You can of course change this parameter at any time.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;Manage Questions&#039;&#039; section of the Questions editing page, once a question has been created, you can use the green and red dots to switch its Required state, as a shortcut alternative of editing the question.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-49-48.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
===Parent Question===&lt;br /&gt;
&lt;br /&gt;
See [[Questionnaire_Conditional_branching|Conditional branching]]&lt;br /&gt;
&lt;br /&gt;
===Question Text===&lt;br /&gt;
Enter your question text in this box. The HTML editor is available, which means that you can display not only formatted text but also images or other media in a questionnaire&#039;s questions text.&lt;br /&gt;
&lt;br /&gt;
==Question Types==&lt;br /&gt;
&lt;br /&gt;
Select the type of question from the drop-down list and click on the &#039;&#039;&#039;Add selected question type&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
===---Page Break---===&lt;br /&gt;
&lt;br /&gt;
Use this to insert page breaks in longish questionnaires. Note that if a page contains questions with required response the respondent will not be allowed to navigate to the next page unless those required responses have been given.&lt;br /&gt;
&lt;br /&gt;
If your questionnaire uses the Conditional branching feature, then page breaks will be &#039;&#039;automatically&#039;&#039; inserted when you add &amp;quot;parent&amp;quot; or &amp;quot;child&amp;quot; questions. Page breaks which are needed to ensure a correct &amp;quot;Conditional branching&amp;quot; flow cannot be moved or deleted. Their Move and Delete icons are disabled.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-58-09.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
===Check Boxes===&lt;br /&gt;
Check boxes allow the user to select multiple answers from a list of options.&lt;br /&gt;
&lt;br /&gt;
==== Question editing interface ====&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 14-58-42.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==== Options ====&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; | Questionnaire View&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{| style=&amp;quot;width: 300&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot; | Question text: What are your favorite hobbies?&lt;br /&gt;
&lt;br /&gt;
Possible answers:&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border: #666666 thin solid&amp;quot; |&lt;br /&gt;
Watching TV&amp;lt;br /&amp;gt; Dancing &amp;lt;br /&amp;gt; Computing&amp;lt;br /&amp;gt; !other=Another hobby:&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
[[Image:05-08-2013 13-29-49.jpg]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may enter &amp;lt;tt&amp;gt;“!other”&amp;lt;/tt&amp;gt; on a line to create an &#039;&#039;&#039;&#039;&#039;optional&#039;&#039;&#039;&#039;&#039; &#039;&#039;fill in the blank&#039;&#039; option. An&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; box defaults to using the prompt &#039;&#039;Other: &#039;&#039;, (or the equivalent translation for &#039;&#039;Other&#039;&#039; in the current language being used). You may change this default prompt by using the format: &amp;lt;tt&amp;gt;“!other=&#039;&#039;prompt text”&#039;&#039;&amp;lt;/tt&amp;gt; as shown in the example above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes.-&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# At the moment the length of the &#039;&#039;fill in the blank&#039;&#039; input text box is set to 25 characters and is not customizable through the online interface.&lt;br /&gt;
# You may provide more than one &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option for a Check Boxes question, but this might cause problems so it is &#039;&#039;not recommended&#039;&#039;.&lt;br /&gt;
# When a respondent answers a&#039;&#039;&#039; Check Boxes&#039;&#039;&#039; question which has been created as &#039;&#039;&#039;Required&#039;&#039;&#039;, and the &#039;&#039;&#039;Min. forced responses &#039;&#039;&#039;and&#039;&#039;&#039; Max. forced responses&#039;&#039;&#039; parameters have been used, then a warning message will be displayed if respondent does not check the required number of boxes. &lt;br /&gt;
# Note that, if the &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option has been created, then if it is checked by the respondent, it will count in the total of minimum/maximum required check boxes.&lt;br /&gt;
# If a respondent checks a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;check box&#039;&#039;&#039; and leaves the text field empty, &#039;&#039;that box will be unchecked&#039;&#039; (upon navigating to the next page or upon submitting the questionnaire).&lt;br /&gt;
# If a respondent has cheked &#039;&#039;a fill in the blank&#039;&#039; option &#039;&#039;&#039;check box&#039;&#039;&#039; and has filled in the text field, and later on changes his mind and unckecks that box, the &#039;&#039;fill in the blank&#039;&#039; text field will be automatically emptied (cool, ain&#039;t it?).&lt;br /&gt;
&lt;br /&gt;
===Date===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Use the day/month/year format, e.g. for March 14th, 1945: &#039;&#039;&#039;14/3/1945&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use this question type if you expect the response to be a correctly formatted date. The format will depend upon the language currently being used by the questionnaire respondent. For example 4/21/2007 (US); 21/4/2007 (UK); 21-4-2007 (France); etc. An example will be displayed in the questionnaire. If an &amp;quot;impossible&amp;quot; or wrongly formatted date is entered, it will either be re-written or reformatted correctly (if possible) or an error message will be displayed to the respondent. In order for dates to be correctly exported to spreadsheets such as Excel, respondent must enter &#039;&#039;a date in the 1902 to 2037 range&#039;&#039;. If a date outside this range is expected from respondents, then use the &#039;&#039;&#039;Text Box&#039;&#039;&#039; question type instead. The date question type will accept dates consisting only of a month plus a year (e.g. 12/2008 for december 2008) or only a year (e.g. 2008). However, for spreadsheet processing compatibility, such incomplete dates will be automatically transformed to complete dd/mm/yy dates, e.g. 12/2008 -&amp;gt; &#039;&#039;&#039;01/&#039;&#039;&#039;12/2008 and 2008 -&amp;gt; &#039;&#039;&#039;01/01/&#039;&#039;&#039;2008. You may have to explain this pecularity to your questionnaire users beforehand.&lt;br /&gt;
&lt;br /&gt;
===Dropdown Box===&lt;br /&gt;
&lt;br /&gt;
There is no real advantage to using the &#039;&#039;&#039;Dropdown Box&#039;&#039;&#039; over using the &#039;&#039;&#039;Radio Buttons&#039;&#039;&#039; except perhaps for longish lists of options, to save screen space.&lt;br /&gt;
&lt;br /&gt;
===Essay Box===&lt;br /&gt;
====Question editing interface====&lt;br /&gt;
[[Image:2014-01-24_15-37-29.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
====Settings====&lt;br /&gt;
This question will display a plain text box with &#039;&#039;&#039;x&#039;&#039;&#039; &#039;&#039;Textarea columns&#039;&#039; (or area &#039;&#039;width&#039;&#039;) and &#039;&#039;&#039;y&#039;&#039;&#039; &#039;&#039;Textarea rows&#039;&#039; (number of text &#039;&#039;lines&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
If you leave both x and y to their default &#039;&#039;&#039;0&#039;&#039;&#039; value (or if you set it to &#039;&#039;&#039;0&#039;&#039;&#039;), then moodle&#039;s &#039;&#039;&#039;HTML editor&#039;&#039;&#039; will be displayed with standard height and width (if available in the course/user context &amp;amp; user profile).&lt;br /&gt;
&lt;br /&gt;
===Label===&lt;br /&gt;
&lt;br /&gt;
This is not a question but a (short) text which will be displayed to introduce a series of questions.&lt;br /&gt;
&lt;br /&gt;
===Numeric===&lt;br /&gt;
&lt;br /&gt;
Use this question type if you expect the response to be a correctly formatted number. By using the &#039;&#039;&#039;Max. digits allowed &#039;&#039;&#039;and &#039;&#039;&#039;Nb of decimal digits &#039;&#039;&#039;parameters you can specify the length and number of decimal places required. Use &#039;&#039;&#039;Max. digits allowed&#039;&#039;&#039; to set a limit to the number of characters entered for a Numeric question. Note that the decimal point also counts as one character! Use &#039;&#039;&#039;Nb of decimal digits&#039;&#039;&#039; to specify the format of the Average value counted and displayed at the Questionnaire Report page.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Max. digits allowed&lt;br /&gt;
! Nb of decimal digits&lt;br /&gt;
! Response entered&lt;br /&gt;
! Average displayed&lt;br /&gt;
|-&lt;br /&gt;
| Example 1&lt;br /&gt;
| 6&lt;br /&gt;
| 2&lt;br /&gt;
| 12&lt;br /&gt;
| 12.00&lt;br /&gt;
|-&lt;br /&gt;
| Example 2&lt;br /&gt;
| 6&lt;br /&gt;
| 2&lt;br /&gt;
| 12.569&lt;br /&gt;
| 12.57&lt;br /&gt;
|-&lt;br /&gt;
| Example 3&lt;br /&gt;
| 8&lt;br /&gt;
| 1&lt;br /&gt;
| 12.57898&lt;br /&gt;
| 12.6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Radio Buttons ===&lt;br /&gt;
====Question editing interface====&lt;br /&gt;
[[Image:05-08-2013 15-03-17.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
====Radio buttons Alignment====&lt;br /&gt;
[[Image:05-08-2013 13-35-04.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Possible answers====&lt;br /&gt;
You must fill in one answer per line in the &#039;&#039;&#039;Possible answers&#039;&#039;&#039; box.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 250&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 243&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
! style=&amp;quot;width: 434&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | (optional horizontal display)&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 1.Possible answers&#039;&#039;&amp;lt;nowiki&amp;gt;: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 2.Possible answers&#039;&#039;&amp;lt;nowiki&amp;gt;: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; !other&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; Other:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black &amp;lt;br /&amp;gt; Other:&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 3.Possible answers:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; !other=Another color:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; Another color:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black &amp;lt;br /&amp;gt; Another color:&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | &#039;&#039;&#039;&#039;&#039; Text data export &#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 4.Possible answers: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
red::the color of blood &amp;lt;br /&amp;gt; blue::the color of the sky &amp;lt;br /&amp;gt; black::opposite of white&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; the color of blood&amp;lt;br /&amp;gt; the color of the sky&amp;lt;br /&amp;gt; opposite of white&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; The &amp;quot;values&amp;quot; red, blue and black will be exported to the columns instead of standard 1, 2 and 3 numbers.&amp;lt;br /&amp;gt; See [[Viewing_Questionnaire_responses#Download_in_text_format|Download in text format]]. &#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 5.Possible answers:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
0=Never&amp;lt;br /&amp;gt; 1=Once a year&amp;lt;br /&amp;gt; 3=Once a month&amp;lt;br /&amp;gt; 5=Once a week&amp;lt;br /&amp;gt; 7=Once a day&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; How often do you practise a sport? &#039;&#039;&#039;Never &amp;lt;br /&amp;gt;Once a year&amp;lt;br /&amp;gt;Once a month&amp;lt;br /&amp;gt;Once a week&amp;lt;br /&amp;gt;Once a day&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may enter &amp;lt;tt&amp;gt;“!other”&amp;lt;/tt&amp;gt; on a line to create an &#039;&#039;&#039;&#039;&#039;optional&#039;&#039;&#039;&#039;&#039; &#039;&#039;fill in the blank&#039;&#039; option. An &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; box defaults to using the prompt &#039;&#039;Other:&#039;&#039;, (or the equivalent translation for &#039;&#039;Other&#039;&#039; in the current language being used). You may change this default prompt by using the format: &amp;lt;tt&amp;gt;“!other=&#039;&#039;prompt text”&#039;&#039;&amp;lt;/tt&amp;gt; as shown in Example #3 above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# At the moment the length of the &#039;&#039;fill in the blank&#039;&#039; input text box is set to 25 characters and is not customizable through the online interface.&lt;br /&gt;
# It does not make sense to provide more than one &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option for a Radio Buttons question.&lt;br /&gt;
# If a respondent checks a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;radio button&#039;&#039;&#039; and leaves the text field empty, &#039;&#039;a warning message will be displayed&#039;&#039; (upon navigating to the next page or upon submitting the questionnaire).&lt;br /&gt;
# If a respondent has checked a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;radio button&#039;&#039;&#039; and has filled in the text field, and later on changes his mind and clicks a different radio button in the same question, the &#039;&#039;fill in the blank&#039;&#039; text field previously entered will be automatically emptied.&lt;br /&gt;
# Example #4 shows a possible &amp;quot;hidden&amp;quot; option, for exporting - in responses - named values as data instead of standard numbers. If you never export your data for studying it in stats packages you won&#039;t need this option.&lt;br /&gt;
# If you plan to use the &#039;&#039;&#039;&#039;&amp;quot;Personality Test&amp;quot;&#039;&#039;&#039;&#039; feature in your questionnaire, the number preceding each choice will be used to calculate the &amp;quot;score&amp;quot; of the section that includes this question. See https://docs.moodle.org/38/en/mod/questionnaire/personality_test#Questions&lt;br /&gt;
&lt;br /&gt;
=== Rate (scale 1..5) ===&lt;br /&gt;
==== Example: ====&lt;br /&gt;
The Rate question now features extra &amp;quot;not yet answered&amp;quot; radio buttons. This is especially useful in Rate questions with a long list of choices.&lt;br /&gt;
[[File:03-12-2013 15-23-57.jpg]]&lt;br /&gt;
&lt;br /&gt;
In case the respondent forgets to check some radio buttons, upon moving to next page or submitting, the error message will be completed with highlighting of the &amp;quot;not yet answered&amp;quot; radio buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:03-12-2013 15-26-58.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== Question editing interface: ====&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 14-26-37.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==== Number of scale items ====&lt;br /&gt;
&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;is the &#039;&#039;number of items&#039;&#039; to be used in your rate scale. You would normally use a value of 3 to 5. Default value: &#039;&#039;&#039;5&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Type of rate scale ====&lt;br /&gt;
* &#039;&#039;&#039; Normal &#039;&#039;&#039; (default value)&lt;br /&gt;
* &#039;&#039;&#039; N/A columns &#039;&#039;&#039; : Choose this if you want an &#039;&#039;&#039;N/A&#039;&#039;&#039; column to be added to the right of your Rate scale items columns.&lt;br /&gt;
* &#039;&#039;&#039; No duplicate choices&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;: Choose this if you want &amp;lt;/nowiki&amp;gt;&#039;&#039;to prevent duplicate choices in each degree &#039;&#039;&#039;column&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
** This is useful if you want the respondent to rank a number of items on a 1 to n scale and to force each rank to be unique. Example: order items A, B and C in order of preference will accept: &#039;&#039;A1, B3 and C2&#039;&#039; or &#039;&#039;A3, B2 and C1&#039;&#039;, but &#039;&#039;it will not be possible&#039;&#039; for the respondent to enter: &#039;&#039;A1, B1, C2&#039;&#039; or &#039;&#039;A1, B2, C2,&#039;&#039; etc.&lt;br /&gt;
** Used in conjunction with [[#anchor_one|named degrees]], this &#039;&#039;&#039;No duplicate choices&#039;&#039;&#039; option can also be useful if you want the respondent to match items with named degrees, e.g. the colors &#039;&#039;red, blue, yellow&#039;&#039; with a set of physiological responses: &#039;&#039;excitement, tranquillity, concentration&#039;&#039; where &#039;&#039;&#039;one&#039;&#039;&#039; color can only match &#039;&#039;&#039;one&#039;&#039;&#039; physiological response.&lt;br /&gt;
* &#039;&#039;&#039;Osgood&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;: Choose this to create a question of the &amp;lt;/nowiki&amp;gt;[http://en.wikipedia.org/wiki/Semantic_differential Osgood&#039;s semantic differential] type. This parameter must be used in conjunction with [[#anchor_one|named degrees]].&lt;br /&gt;
&lt;br /&gt;
====Possible answers====&lt;br /&gt;
Examples.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 1 Rate&#039;&#039;&#039; (single line) &amp;lt;br /&amp;gt; &#039;&#039;Possible answers&#039;&#039; -&amp;gt; &#039;&#039;&#039;Enter a blank space or a short &amp;quot;label&amp;quot;.&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039; = 5 (5 columns numbered 1...5);&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Type of rate scale&#039;&#039;&#039;&#039;&#039; = &#039;&#039;Normal&#039;&#039; (N/A column not needed here). &amp;lt;br /&amp;gt;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013_13-53-43.jpg|400px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 2 Rate &#039;&#039;&#039; (several lines)&amp;lt;br /&amp;gt; &#039;&#039;Possible answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Blackboard&amp;lt;br /&amp;gt;Desire2Learn&amp;lt;br /&amp;gt;Moodle&amp;lt;br /&amp;gt;Sakai&amp;lt;br /&amp;gt;WebCT&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &amp;lt;br /&amp;gt;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 4 (4 columns numbered 1...4)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Type of rate scale&#039;&#039;&#039;&#039;&#039; = &#039;&#039; N/A column &#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 13-50-05.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 2a Rate (&amp;quot;ordering&amp;quot;) &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This option makes it impossible to click more than one radio button per column; it is thus equivalent to an &amp;quot;ordering&amp;quot; question type.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 3 (3 columns numbered 1...3) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale&#039;&#039;&#039;&#039;&#039; = &#039;&#039;No duplicate choices&#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 13-59-31.jpg|400px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 3 Rate &#039;&#039;with named degrees &#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;Question text&#039;&#039; : How would you rate the ease of use for each of the following items based on your experience with Moodle?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Possible answers&#039;&#039;:&amp;lt;br /&amp;gt;&lt;br /&gt;
Formatting Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
Laying out Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
Number of Clicks to Access Needed Content&amp;lt;br /&amp;gt;&lt;br /&gt;
Adding Content&amp;lt;br /&amp;gt;&lt;br /&gt;
Ability to Add/Change Themes/Appearance&amp;lt;br /&amp;gt;&lt;br /&gt;
Overall Navigation of Moodle&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Named degrees&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
4=Very easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
3=Easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
2=Somewhat difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
1=Difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 4 (4 named columns) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale &#039;&#039;&#039;&#039;&#039; = &#039;&#039; Normal &#039;&#039; (N/A column not needed here)&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 14-04-00.jpg|600px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 3b Rate &#039;&#039;with named degrees &#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; &#039;&#039;Possible answers&#039;&#039;:&amp;lt;br /&amp;gt;&lt;br /&gt;
formatting::Formatting Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
layout::Laying out Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
clicks::Number of Clicks to Access Needed Content&amp;lt;br /&amp;gt;&lt;br /&gt;
addcontent::Adding Content&amp;lt;br /&amp;gt;&lt;br /&gt;
appearance::Ability to Add/Change Themes/Appearance&amp;lt;br /&amp;gt;&lt;br /&gt;
navigation::Overall Navigation of Moodle&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Named degrees&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
4=Very easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
3=Easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
2=Somewhat difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
1=Difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
If the choice options text is fairly long, you may use shorter &amp;quot;labels&amp;quot; immediately followed by two colons (::).&lt;br /&gt;
The labels &amp;quot;formatting&amp;quot;, &amp;quot;layout&amp;quot;, &amp;quot;clicks&amp;quot; etc. will be saved to the columns headings in the Download as text format operation, instead of the longer labels which will be displayed to the questionnaire respondent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; that in former versions of Questionnaire the separator between &amp;quot;short label&amp;quot; and &amp;quot;options text&amp;quot; used to be the equal sign (=). In Questionnaire 2.5 and later, please use two colons (::) as a separator.&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 4 [http://en.wikipedia.org/wiki/Semantic_differential Osgood&#039;s Semantic differential] &#039;&#039;&#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; Possible answers.&lt;br /&gt;
&lt;br /&gt;
1=--&amp;lt;br /&amp;gt; 2=-&amp;lt;br /&amp;gt; 3=±&amp;lt;br /&amp;gt; 4=+&amp;lt;br /&amp;gt; 5=++&amp;lt;br /&amp;gt; weak|strong&amp;lt;br /&amp;gt; cold|warm&amp;lt;br /&amp;gt; cowardly|brave&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 5 (5 named columns) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale &#039;&#039;&#039;&#039;&#039; = &#039;&#039;Osgood&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Note.- &#039;&#039;&#039; To separate the pairs of words you must use a pipe character &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 14-06-54.jpg]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes.-&#039;&#039;&#039; &amp;lt;span id=&amp;quot;anchor_one&amp;quot;&amp;gt;&#039;&#039;&#039;named degrees&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this question type you have two display options. The default option displays the [http://en.wikipedia.org/wiki/Likert_scale Likert] scale degrees as numbers (1...5). If you prefer to have named degrees instead of numbers, you&#039;ll have to enter those names in the &#039;&#039;&#039;&#039;&#039;Named degrees&#039;&#039;&#039;&#039;&#039; list (see &#039;&#039;&#039;&#039;&#039;Example 3 &#039;&#039;&#039;&#039;&#039; above). On each line of &amp;quot;Named degrees&amp;quot; enter the degree number, &#039;&#039;immediately followed&#039;&#039; by the equal sign &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; &#039;&#039;immediately followed&#039;&#039; by the name you want to give to that degree.&lt;br /&gt;
&lt;br /&gt;
If you plan to use the &amp;quot;Personality Test&amp;quot; feature in your questionnaire, the number preceding each named degree will be used to calculate the &amp;quot;score&amp;quot; of the section that includes this question. See https://docs.moodle.org/38/en/mod/questionnaire/personality_test#Questions_2.&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;the number of named degrees&#039;&#039; in the possible answers list &#039;&#039;is different from the number determined by the value you entered&#039;&#039; in the &#039;&#039;&#039;Nb of scale items&#039;&#039;&#039; field, this will be automatically adjusted when you save the question.&lt;br /&gt;
&lt;br /&gt;
Example #3b shows a possible &amp;quot;hidden&amp;quot; option, for exporting - in responses - shorter label instead of the longer text values. If you never export your data for studying it in stats packages you won&#039;t need this option. Please note that the example is provided here for the &#039;&#039;&#039;Rate &#039;&#039;with named degrees&#039;&#039;&#039;&#039;&#039; question sub-type but it works for all Rate question sub-types except Osgood which requires short left and right options anyway.&lt;br /&gt;
&lt;br /&gt;
===Text Box===&lt;br /&gt;
&lt;br /&gt;
For the Text Box question type, enter the Input Box length and the Maximum text length of text to be entered by respondent.&lt;br /&gt;
&lt;br /&gt;
Default values are 20 characters for the Input Box width and 25 characters for the maximum length of text entered.&lt;br /&gt;
&lt;br /&gt;
===Yes/No===&lt;br /&gt;
&lt;br /&gt;
==Manage questions==&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Manage questions&#039;&#039;&#039; section of the Edit Questions page, you can conduct a number of operations on a Questionnaire&#039;s questions. Normally you should never add questions or delete questions in a questionnaire that is live in a moodle course, and which some students may have already responded to.&lt;br /&gt;
&lt;br /&gt;
You can Move a question to a different position in the Questionnaire. If your questionnaire contains some &amp;quot;conditional branching&amp;quot; questions, you may not be able to move some of the parent or child questions to some positions which would ruin the branching.&lt;br /&gt;
&lt;br /&gt;
You can Edit a question, but again, be extra careful when editing questions once students have started to complete a questionnaire.&lt;br /&gt;
&lt;br /&gt;
If you try to Delete a child or parent question (in a Conditional branching questionnaire), you will be warned of the possible consequences of those deletions.&lt;br /&gt;
&lt;br /&gt;
By clicking on the Green or Red dots, you can switch the &amp;quot;Response required&amp;quot; status of questions.&lt;br /&gt;
&lt;br /&gt;
Please note that the numbers in front of each question in this interface are &#039;&#039;not&#039;&#039; the question numbers that will be displayed when answering the questionnaire. Here, these numbers indicate the question&#039;s position, and even non-real questions such as Labels and Page Breaks have a position number.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
[[es:Editando preguntas de un cuestionario]]&lt;br /&gt;
[[fr:Ajouter_des_questions]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Editing_Questionnaire_questions&amp;diff=137004</id>
		<title>Editing Questionnaire questions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Editing_Questionnaire_questions&amp;diff=137004"/>
		<updated>2020-05-13T21:26:09Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Possible answers */ Updated the documentation with the new  Named degrees field for Rate question type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questionnaire}}&lt;br /&gt;
&lt;br /&gt;
==Editing questions==&lt;br /&gt;
* On the Questionnaire &#039;&#039;&#039;Editing Questions&#039;&#039;&#039; page is displayed a drop-down list of the question types available and a list of the questions already created for the current questionnaire instance (if any).&lt;br /&gt;
* Using the standard Moodle icons you can change the order of the questions in the questionnaire, edit or delete questions.&lt;br /&gt;
&lt;br /&gt;
==Common options==&lt;br /&gt;
===Question Name===&lt;br /&gt;
&lt;br /&gt;
====Questionnaires &#039;&#039;&#039;not&#039;&#039;&#039; using the Conditional Branching or the Personality Test features====&lt;br /&gt;
&lt;br /&gt;
You can &#039;&#039;optionally&#039;&#039; enter a &#039;&#039;&#039;Question Name&#039;&#039;&#039; for each question.&lt;br /&gt;
&lt;br /&gt;
If your questionnaire does not use the &amp;quot;Conditional Branching&amp;quot; or the &amp;quot;Personality Test&amp;quot; feature, the &#039;&#039;&#039;Question Name&#039;&#039;&#039; is only used when you export responses to CSV/Excel format. If you never export to CSV, then you needn&#039;t worry about Question names. If you plan to regularly export your questionnaire data to CSV, then you have a choice of two options for question naming.&lt;br /&gt;
&lt;br /&gt;
=====Option 1: significant names=====&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Question Name &#039;&#039;&#039; box, enter &#039;&#039;meaningful&#039;&#039;, &#039;&#039;short&#039;&#039; and &#039;&#039;&#039;&#039;&#039;different&#039;&#039;&#039;&#039;&#039; question names for all of the questions within one questionnaire. In the CSV export file, all those question names will be prefixed with the question&#039;s actual number (= position) in the quiz. Examples:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | question number (position) in the questionnaire&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | question name entered by teacher&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | field header in csv export&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;5&amp;lt;/div&amp;gt;&lt;br /&gt;
| favorite colors&lt;br /&gt;
| Q05_favorite colors&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;6&amp;lt;/div&amp;gt;&lt;br /&gt;
| why_use_Moodle&lt;br /&gt;
| Q06_why_use_moodle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;7&amp;lt;/div&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
user-friendliness&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; (rate question with 3 possible answers: Moodle, WebCT and Blackboard) &#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
Q07_user-friendliness-&amp;gt;Moodle&amp;lt;br /&amp;gt; Q07_user-friendliness-&amp;gt;WebCT&amp;lt;br /&amp;gt; Q07_user-friendliness-&amp;gt;Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Option 2: leave the Question Name boxes blank=====&lt;br /&gt;
&lt;br /&gt;
For each un-named question, CSV export will automatically generate a question name. This is required for table header fields in the CSV and subsequent Excel tables or any statistics package you might be using. The question name generated will be based on the question number in the actual Quiz (excluding &#039;&#039;Section Text&#039;&#039; pseudo-questions, of course) e.g. Q01, Q02, ... Q99. For questions with multiple answers, such as rate-type or Likert type questions, a sub-question number will be generated (Q02_1, Q02_2, Q02_3, etc.). This type of &amp;quot;short-name&amp;quot; naming scheme is advisable for exporting your data to a statistics software. Of course, it&#039;s up to you to have your own system for remembering which abbreviated question name corresponds to which question in your questionnaire!&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | question number (position) in the questionnaire&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | question name entered by teacher&lt;br /&gt;
! style=&amp;quot;width: 33%&amp;quot; scope=&amp;quot;col&amp;quot; | field header in csv export&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;5&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
| Q05&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;6&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
| Q06&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;7&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color: #CCCCCC&amp;quot; |&lt;br /&gt;
|&lt;br /&gt;
Q07_1&amp;lt;br /&amp;gt; Q07_2&amp;lt;br /&amp;gt; Q07_3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is quite possible (but maybe not advisable) to mix the two systems, and have within one questionnaire both named and un-named questions.&lt;br /&gt;
&lt;br /&gt;
====Questionnaires using the Conditional Branching feature====&lt;br /&gt;
&lt;br /&gt;
If you need a question to be used as the &amp;quot;parent&amp;quot; of one or more subsequent questions in your questionnaire, then you &#039;&#039;&#039;must&#039;&#039;&#039; name that &amp;quot;parent question&amp;quot;. Only those (radio buttons, dropdown list or yes/no) questions with a &#039;&#039;name&#039;&#039; will appear in the Parent question dropdown list when adding a new question, as shown on the following screenshots.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-26-11.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-34-55.jpg]]&lt;br /&gt;
&lt;br /&gt;
For more information, see [[Questionnaire_Conditional_branching|Conditional branching]].&lt;br /&gt;
&lt;br /&gt;
===Response Required===&lt;br /&gt;
If you select &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039;, response to this question will be required, i.e. the respondent will not be able to submit the questionnaire until this question has been answered. If the respondent tries to submit a questionnaire with unanswered required questions (or, in the case of a questionnaire with more than one section, to go to the next page), a warning message will be displayed with a list of all the missing &#039;&#039;required &#039;&#039;questions in the questionnaire (or on the actual page).&lt;br /&gt;
&lt;br /&gt;
Default.- &#039;&#039;&#039;&#039;&#039;No&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;.- When you create new questions in sequence (one after the other), this parameter is carried over to subsequent questions. E.g. if you create question #1 with &#039;&#039;&#039;Response Required&#039;&#039;&#039; = &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039;, then the &#039;&#039;&#039;Response Required&#039;&#039;&#039; parameter will be pre-set to &#039;&#039;&#039;&#039;&#039;Yes&#039;&#039;&#039;&#039;&#039; for question #2, etc. You can of course change this parameter at any time.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;Manage Questions&#039;&#039; section of the Questions editing page, once a question has been created, you can use the green and red dots to switch its Required state, as a shortcut alternative of editing the question.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-49-48.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
===Parent Question===&lt;br /&gt;
&lt;br /&gt;
See [[Questionnaire_Conditional_branching|Conditional branching]]&lt;br /&gt;
&lt;br /&gt;
===Question Text===&lt;br /&gt;
Enter your question text in this box. The HTML editor is available, which means that you can display not only formatted text but also images or other media in a questionnaire&#039;s questions text.&lt;br /&gt;
&lt;br /&gt;
==Question Types==&lt;br /&gt;
&lt;br /&gt;
Select the type of question from the drop-down list and click on the &#039;&#039;&#039;Add selected question type&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
===---Page Break---===&lt;br /&gt;
&lt;br /&gt;
Use this to insert page breaks in longish questionnaires. Note that if a page contains questions with required response the respondent will not be allowed to navigate to the next page unless those required responses have been given.&lt;br /&gt;
&lt;br /&gt;
If your questionnaire uses the Conditional branching feature, then page breaks will be &#039;&#039;automatically&#039;&#039; inserted when you add &amp;quot;parent&amp;quot; or &amp;quot;child&amp;quot; questions. Page breaks which are needed to ensure a correct &amp;quot;Conditional branching&amp;quot; flow cannot be moved or deleted. Their Move and Delete icons are disabled.&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 15-58-09.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
===Check Boxes===&lt;br /&gt;
Check boxes allow the user to select multiple answers from a list of options.&lt;br /&gt;
&lt;br /&gt;
==== Question editing interface ====&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 14-58-42.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==== Options ====&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; | Questionnaire View&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{| style=&amp;quot;width: 300&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot; | Question text: What are your favorite hobbies?&lt;br /&gt;
&lt;br /&gt;
Possible answers:&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border: #666666 thin solid&amp;quot; |&lt;br /&gt;
Watching TV&amp;lt;br /&amp;gt; Dancing &amp;lt;br /&amp;gt; Computing&amp;lt;br /&amp;gt; !other=Another hobby:&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
[[Image:05-08-2013 13-29-49.jpg]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may enter &amp;lt;tt&amp;gt;“!other”&amp;lt;/tt&amp;gt; on a line to create an &#039;&#039;&#039;&#039;&#039;optional&#039;&#039;&#039;&#039;&#039; &#039;&#039;fill in the blank&#039;&#039; option. An&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; box defaults to using the prompt &#039;&#039;Other: &#039;&#039;, (or the equivalent translation for &#039;&#039;Other&#039;&#039; in the current language being used). You may change this default prompt by using the format: &amp;lt;tt&amp;gt;“!other=&#039;&#039;prompt text”&#039;&#039;&amp;lt;/tt&amp;gt; as shown in the example above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes.-&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# At the moment the length of the &#039;&#039;fill in the blank&#039;&#039; input text box is set to 25 characters and is not customizable through the online interface.&lt;br /&gt;
# You may provide more than one &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option for a Check Boxes question, but this might cause problems so it is &#039;&#039;not recommended&#039;&#039;.&lt;br /&gt;
# When a respondent answers a&#039;&#039;&#039; Check Boxes&#039;&#039;&#039; question which has been created as &#039;&#039;&#039;Required&#039;&#039;&#039;, and the &#039;&#039;&#039;Min. forced responses &#039;&#039;&#039;and&#039;&#039;&#039; Max. forced responses&#039;&#039;&#039; parameters have been used, then a warning message will be displayed if respondent does not check the required number of boxes. &lt;br /&gt;
# Note that, if the &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option has been created, then if it is checked by the respondent, it will count in the total of minimum/maximum required check boxes.&lt;br /&gt;
# If a respondent checks a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;check box&#039;&#039;&#039; and leaves the text field empty, &#039;&#039;that box will be unchecked&#039;&#039; (upon navigating to the next page or upon submitting the questionnaire).&lt;br /&gt;
# If a respondent has cheked &#039;&#039;a fill in the blank&#039;&#039; option &#039;&#039;&#039;check box&#039;&#039;&#039; and has filled in the text field, and later on changes his mind and unckecks that box, the &#039;&#039;fill in the blank&#039;&#039; text field will be automatically emptied (cool, ain&#039;t it?).&lt;br /&gt;
&lt;br /&gt;
===Date===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Use the day/month/year format, e.g. for March 14th, 1945: &#039;&#039;&#039;14/3/1945&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use this question type if you expect the response to be a correctly formatted date. The format will depend upon the language currently being used by the questionnaire respondent. For example 4/21/2007 (US); 21/4/2007 (UK); 21-4-2007 (France); etc. An example will be displayed in the questionnaire. If an &amp;quot;impossible&amp;quot; or wrongly formatted date is entered, it will either be re-written or reformatted correctly (if possible) or an error message will be displayed to the respondent. In order for dates to be correctly exported to spreadsheets such as Excel, respondent must enter &#039;&#039;a date in the 1902 to 2037 range&#039;&#039;. If a date outside this range is expected from respondents, then use the &#039;&#039;&#039;Text Box&#039;&#039;&#039; question type instead. The date question type will accept dates consisting only of a month plus a year (e.g. 12/2008 for december 2008) or only a year (e.g. 2008). However, for spreadsheet processing compatibility, such incomplete dates will be automatically transformed to complete dd/mm/yy dates, e.g. 12/2008 -&amp;gt; &#039;&#039;&#039;01/&#039;&#039;&#039;12/2008 and 2008 -&amp;gt; &#039;&#039;&#039;01/01/&#039;&#039;&#039;2008. You may have to explain this pecularity to your questionnaire users beforehand.&lt;br /&gt;
&lt;br /&gt;
===Dropdown Box===&lt;br /&gt;
&lt;br /&gt;
There is no real advantage to using the &#039;&#039;&#039;Dropdown Box&#039;&#039;&#039; over using the &#039;&#039;&#039;Radio Buttons&#039;&#039;&#039; except perhaps for longish lists of options, to save screen space.&lt;br /&gt;
&lt;br /&gt;
===Essay Box===&lt;br /&gt;
====Question editing interface====&lt;br /&gt;
[[Image:2014-01-24_15-37-29.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
====Settings====&lt;br /&gt;
This question will display a plain text box with &#039;&#039;&#039;x&#039;&#039;&#039; &#039;&#039;Textarea columns&#039;&#039; (or area &#039;&#039;width&#039;&#039;) and &#039;&#039;&#039;y&#039;&#039;&#039; &#039;&#039;Textarea rows&#039;&#039; (number of text &#039;&#039;lines&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
If you leave both x and y to their default &#039;&#039;&#039;0&#039;&#039;&#039; value (or if you set it to &#039;&#039;&#039;0&#039;&#039;&#039;), then moodle&#039;s &#039;&#039;&#039;HTML editor&#039;&#039;&#039; will be displayed with standard height and width (if available in the course/user context &amp;amp; user profile).&lt;br /&gt;
&lt;br /&gt;
===Label===&lt;br /&gt;
&lt;br /&gt;
This is not a question but a (short) text which will be displayed to introduce a series of questions.&lt;br /&gt;
&lt;br /&gt;
===Numeric===&lt;br /&gt;
&lt;br /&gt;
Use this question type if you expect the response to be a correctly formatted number. By using the &#039;&#039;&#039;Max. digits allowed &#039;&#039;&#039;and &#039;&#039;&#039;Nb of decimal digits &#039;&#039;&#039;parameters you can specify the length and number of decimal places required. Use &#039;&#039;&#039;Max. digits allowed&#039;&#039;&#039; to set a limit to the number of characters entered for a Numeric question. Note that the decimal point also counts as one character! Use &#039;&#039;&#039;Nb of decimal digits&#039;&#039;&#039; to specify the format of the Average value counted and displayed at the Questionnaire Report page.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Max. digits allowed&lt;br /&gt;
! Nb of decimal digits&lt;br /&gt;
! Response entered&lt;br /&gt;
! Average displayed&lt;br /&gt;
|-&lt;br /&gt;
| Example 1&lt;br /&gt;
| 6&lt;br /&gt;
| 2&lt;br /&gt;
| 12&lt;br /&gt;
| 12.00&lt;br /&gt;
|-&lt;br /&gt;
| Example 2&lt;br /&gt;
| 6&lt;br /&gt;
| 2&lt;br /&gt;
| 12.569&lt;br /&gt;
| 12.57&lt;br /&gt;
|-&lt;br /&gt;
| Example 3&lt;br /&gt;
| 8&lt;br /&gt;
| 1&lt;br /&gt;
| 12.57898&lt;br /&gt;
| 12.6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Radio Buttons ===&lt;br /&gt;
====Question editing interface====&lt;br /&gt;
[[Image:05-08-2013 15-03-17.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
====Radio buttons Alignment====&lt;br /&gt;
[[Image:05-08-2013 13-35-04.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Possible answers====&lt;br /&gt;
You must fill in one answer per line in the &#039;&#039;&#039;Possible answers&#039;&#039;&#039; box.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 250&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 243&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
! style=&amp;quot;width: 434&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | (optional horizontal display)&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 1.Possible answers&#039;&#039;&amp;lt;nowiki&amp;gt;: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 2.Possible answers&#039;&#039;&amp;lt;nowiki&amp;gt;: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; !other&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; Other:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black &amp;lt;br /&amp;gt; Other:&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 3.Possible answers:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; !other=Another color:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red&amp;lt;br /&amp;gt; Blue&amp;lt;br /&amp;gt; Black&amp;lt;br /&amp;gt; Another color:&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; Red  Blue  Black &amp;lt;br /&amp;gt; Another color:&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | &#039;&#039;&#039;&#039;&#039; Text data export &#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 4.Possible answers: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
red::the color of blood &amp;lt;br /&amp;gt; blue::the color of the sky &amp;lt;br /&amp;gt; black::opposite of white&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; What is your favorite color? &#039;&#039;&#039;&amp;lt;br /&amp;gt; the color of blood&amp;lt;br /&amp;gt; the color of the sky&amp;lt;br /&amp;gt; opposite of white&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; The &amp;quot;values&amp;quot; red, blue and black will be exported to the columns instead of standard 1, 2 and 3 numbers.&amp;lt;br /&amp;gt; See [[Viewing_Questionnaire_responses#Download_in_text_format|Download in text format]]. &#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039; 5.Possible answers:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
0=Never&amp;lt;br /&amp;gt; 1=Once a year&amp;lt;br /&amp;gt; 3=Once a month&amp;lt;br /&amp;gt; 5=Once a week&amp;lt;br /&amp;gt; 7=Once a day&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; How often do you practise a sport? &#039;&#039;&#039;Never &amp;lt;br /&amp;gt;Once a year&amp;lt;br /&amp;gt;Once a month&amp;lt;br /&amp;gt;Once a week&amp;lt;br /&amp;gt;Once a day&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may enter &amp;lt;tt&amp;gt;“!other”&amp;lt;/tt&amp;gt; on a line to create an &#039;&#039;&#039;&#039;&#039;optional&#039;&#039;&#039;&#039;&#039; &#039;&#039;fill in the blank&#039;&#039; option. An &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; box defaults to using the prompt &#039;&#039;Other:&#039;&#039;, (or the equivalent translation for &#039;&#039;Other&#039;&#039; in the current language being used). You may change this default prompt by using the format: &amp;lt;tt&amp;gt;“!other=&#039;&#039;prompt text”&#039;&#039;&amp;lt;/tt&amp;gt; as shown in Example #3 above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# At the moment the length of the &#039;&#039;fill in the blank&#039;&#039; input text box is set to 25 characters and is not customizable through the online interface.&lt;br /&gt;
# It does not make sense to provide more than one &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;!other&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; &#039;&#039;fill in the blank&#039;&#039; option for a Radio Buttons question.&lt;br /&gt;
# If a respondent checks a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;radio button&#039;&#039;&#039; and leaves the text field empty, &#039;&#039;a warning message will be displayed&#039;&#039; (upon navigating to the next page or upon submitting the questionnaire).&lt;br /&gt;
# If a respondent has checked a &#039;&#039;fill in the blank&#039;&#039; option &#039;&#039;&#039;radio button&#039;&#039;&#039; and has filled in the text field, and later on changes his mind and clicks a different radio button in the same question, the &#039;&#039;fill in the blank&#039;&#039; text field previously entered will be automatically emptied.&lt;br /&gt;
# Example #4 shows a possible &amp;quot;hidden&amp;quot; option, for exporting - in responses - named values as data instead of standard numbers. If you never export your data for studying it in stats packages you won&#039;t need this option.&lt;br /&gt;
# If you plan to use the &#039;&#039;&#039;&#039;&amp;quot;Personality Test&amp;quot;&#039;&#039;&#039;&#039; feature in your questionnaire, the number preceding each choice will be used to calculate the &amp;quot;score&amp;quot; of the section that includes this question. See https://docs.moodle.org/38/en/mod/questionnaire/personality_test#Questions&lt;br /&gt;
&lt;br /&gt;
=== Rate (scale 1..5) ===&lt;br /&gt;
==== Example: ====&lt;br /&gt;
The Rate question now features extra &amp;quot;not yet answered&amp;quot; radio buttons. This is especially useful in Rate questions with a long list of choices.&lt;br /&gt;
[[File:03-12-2013 15-23-57.jpg]]&lt;br /&gt;
&lt;br /&gt;
In case the respondent forgets to check some radio buttons, upon moving to next page or submitting, the error message will be completed with highlighting of the &amp;quot;not yet answered&amp;quot; radio buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:03-12-2013 15-26-58.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== Question editing interface: ====&lt;br /&gt;
&lt;br /&gt;
[[Image:05-08-2013 14-26-37.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==== Number of scale items ====&lt;br /&gt;
&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;is the &#039;&#039;number of items&#039;&#039; to be used in your rate scale. You would normally use a value of 3 to 5. Default value: &#039;&#039;&#039;5&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Type of rate scale ====&lt;br /&gt;
* &#039;&#039;&#039; Normal &#039;&#039;&#039; (default value)&lt;br /&gt;
* &#039;&#039;&#039; N/A columns &#039;&#039;&#039; : Choose this if you want an &#039;&#039;&#039;N/A&#039;&#039;&#039; column to be added to the right of your Rate scale items columns.&lt;br /&gt;
* &#039;&#039;&#039; No duplicate choices&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;: Choose this if you want &amp;lt;/nowiki&amp;gt;&#039;&#039;to prevent duplicate choices in each degree &#039;&#039;&#039;column&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
** This is useful if you want the respondent to rank a number of items on a 1 to n scale and to force each rank to be unique. Example: order items A, B and C in order of preference will accept: &#039;&#039;A1, B3 and C2&#039;&#039; or &#039;&#039;A3, B2 and C1&#039;&#039;, but &#039;&#039;it will not be possible&#039;&#039; for the respondent to enter: &#039;&#039;A1, B1, C2&#039;&#039; or &#039;&#039;A1, B2, C2,&#039;&#039; etc.&lt;br /&gt;
** Used in conjunction with [[#anchor_one|named degrees]], this &#039;&#039;&#039;No duplicate choices&#039;&#039;&#039; option can also be useful if you want the respondent to match items with named degrees, e.g. the colors &#039;&#039;red, blue, yellow&#039;&#039; with a set of physiological responses: &#039;&#039;excitement, tranquillity, concentration&#039;&#039; where &#039;&#039;&#039;one&#039;&#039;&#039; color can only match &#039;&#039;&#039;one&#039;&#039;&#039; physiological response.&lt;br /&gt;
* &#039;&#039;&#039;Osgood&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;: Choose this to create a question of the &amp;lt;/nowiki&amp;gt;[http://en.wikipedia.org/wiki/Semantic_differential Osgood&#039;s semantic differential] type. This parameter must be used in conjunction with [[#anchor_one|named degrees]].&lt;br /&gt;
&lt;br /&gt;
====Possible answers====&lt;br /&gt;
Examples.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Editing Mode&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; scope=&amp;quot;col&amp;quot; valign=&amp;quot;top&amp;quot; | Questionnaire View&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 1 Rate&#039;&#039;&#039; (single line) &amp;lt;br /&amp;gt; Possible answers -&amp;gt; &#039;&#039;&#039;Enter a blank space or a short &amp;quot;label&amp;quot;.&#039;&#039;&#039; &#039;&#039;&#039;Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039; = 5 (5 columns numbered 1...5);&#039;&#039;&#039;&#039;&#039;Type of rate scale&#039;&#039;&#039;&#039;&#039; = &#039;&#039;Normal&#039;&#039; (N/A column not needed here). &amp;lt;br /&amp;gt;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013_13-53-43.jpg|400px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 2 Rate &#039;&#039;&#039; (several lines)&amp;lt;br /&amp;gt; Possible answers.&lt;br /&gt;
&lt;br /&gt;
Blackboard&amp;lt;br /&amp;gt;Desire2Learn&amp;lt;br /&amp;gt;Moodle&amp;lt;br /&amp;gt;Sakai&amp;lt;br /&amp;gt;WebCT&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &amp;lt;br /&amp;gt;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 4 (4 columns numbered 1...4)&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale &#039;&#039;&#039;&#039;&#039; = &#039;&#039; N/A column &#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 13-50-05.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 2a Rate (&amp;quot;ordering&amp;quot;) &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This option makes it impossible to click more than one radio button per column; it is thus equivalent to an &amp;quot;ordering&amp;quot; question type.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 3 (3 columns numbered 1...3) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale&#039;&#039;&#039;&#039;&#039; = &#039;&#039;No duplicate choices&#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 13-59-31.jpg|400px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 3 Rate &#039;&#039;with named degrees &#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;Question text&#039;&#039; : How would you rate the ease of use for each of the following items based on your experience with Moodle?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Possible answers&#039;&#039;:&amp;lt;br /&amp;gt;&lt;br /&gt;
Formatting Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
Laying out Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
Number of Clicks to Access Needed Content&amp;lt;br /&amp;gt;&lt;br /&gt;
Adding Content&amp;lt;br /&amp;gt;&lt;br /&gt;
Ability to Add/Change Themes/Appearance&amp;lt;br /&amp;gt;&lt;br /&gt;
Overall Navigation of Moodle&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Named degrees&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
4=Very easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
3=Easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
2=Somewhat difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
1=Difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 4 (4 named columns) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale &#039;&#039;&#039;&#039;&#039; = &#039;&#039; Normal &#039;&#039; (N/A column not needed here)&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 14-04-00.jpg|600px]]&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 3b Rate &#039;&#039;with named degrees &#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; &#039;&#039;Possible answers&#039;&#039;:&amp;lt;br /&amp;gt;&lt;br /&gt;
formatting::Formatting Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
layout::Laying out Your Course&amp;lt;br /&amp;gt;&lt;br /&gt;
clicks::Number of Clicks to Access Needed Content&amp;lt;br /&amp;gt;&lt;br /&gt;
addcontent::Adding Content&amp;lt;br /&amp;gt;&lt;br /&gt;
appearance::Ability to Add/Change Themes/Appearance&amp;lt;br /&amp;gt;&lt;br /&gt;
navigation::Overall Navigation of Moodle&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Named degrees&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
4=Very easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
3=Easy to use&amp;lt;br /&amp;gt;&lt;br /&gt;
2=Somewhat difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
1=Difficult to use&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
If the choice options text is fairly long, you may use shorter &amp;quot;labels&amp;quot; immediately followed by two colons (::).&lt;br /&gt;
The labels &amp;quot;formatting&amp;quot;, &amp;quot;layout&amp;quot;, &amp;quot;clicks&amp;quot; etc. will be saved to the columns headings in the Download as text format operation, instead of the longer labels which will be displayed to the questionnaire respondent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; that in former versions of Questionnaire the separator between &amp;quot;short label&amp;quot; and &amp;quot;options text&amp;quot; used to be the equal sign (=). In Questionnaire 2.5 and later, please use two colons (::) as a separator.&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
&#039;&#039;&#039; Ex. 4 [http://en.wikipedia.org/wiki/Semantic_differential Osgood&#039;s Semantic differential] &#039;&#039;&#039;&#039; &#039;&#039;&#039;&amp;lt;br /&amp;gt; Possible answers.&lt;br /&gt;
&lt;br /&gt;
1=--&amp;lt;br /&amp;gt; 2=-&amp;lt;br /&amp;gt; 3=±&amp;lt;br /&amp;gt; 4=+&amp;lt;br /&amp;gt; 5=++&amp;lt;br /&amp;gt; weak|strong&amp;lt;br /&amp;gt; cold|warm&amp;lt;br /&amp;gt; cowardly|brave&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Settings: &#039;&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Nb of scale items &#039;&#039;&#039;&#039;&#039; = 5 (5 named columns) &amp;lt;br /&amp;gt;&#039;&#039;&#039;&#039;&#039; Type of rate scale &#039;&#039;&#039;&#039;&#039; = &#039;&#039;Osgood&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Note.- &#039;&#039;&#039; To separate the pairs of words you must use a pipe character &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
[[Image:05-08-2013 14-06-54.jpg]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes.-&#039;&#039;&#039; &amp;lt;span id=&amp;quot;anchor_one&amp;quot;&amp;gt;&#039;&#039;&#039;named degrees&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this question type you have two display options. The default option displays the [http://en.wikipedia.org/wiki/Likert_scale Likert] scale degrees as numbers (1...5). If you prefer to have named degrees instead of numbers, you&#039;ll have to enter those names in the &#039;&#039;&#039;&#039;&#039;Possible answers&#039;&#039;&#039;&#039;&#039; list (see &#039;&#039;&#039;&#039;&#039;Example 3 &#039;&#039;&#039;&#039;&#039; above). On each line of &amp;quot;possible answers&amp;quot; enter the degree number, &#039;&#039;immediately followed&#039;&#039; by the equal sign &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; &#039;&#039;immediately followed&#039;&#039; by the name you want to give to that degree.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you plan to use the &amp;quot;Personality Test&amp;quot; feature in your questionnaire, the number preceding each named degree will be used to calculate the &amp;quot;score&amp;quot; of the section that includes this question. See https://docs.moodle.org/38/en/mod/questionnaire/personality_test#Questions_2.&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;the number of named degrees&#039;&#039; in the possible answers list &#039;&#039;is different from the number determined by the value you entered&#039;&#039; in the &#039;&#039;&#039;Nb of scale items&#039;&#039;&#039; field, this will be automatically adjusted when you save the question. If you decide to use named degrees for your Likert scale, it is recommended (but not obligatory) to start your list of possible answers with the named degrees, and then to enter the various &#039;&#039;items&#039;&#039; to be scaled.&lt;br /&gt;
&lt;br /&gt;
Example #3b shows a possible &amp;quot;hidden&amp;quot; option, for exporting - in responses - shorter label instead of the longer text values. If you never export your data for studying it in stats packages you won&#039;t need this option. Please note that the example is provided here for the &#039;&#039;&#039;Rate &#039;&#039;with named degrees&#039;&#039;&#039;&#039;&#039; question sub-type but it works for all Rate question sub-types except Osgood which requires short left and right options anyway.&lt;br /&gt;
&lt;br /&gt;
===Text Box===&lt;br /&gt;
&lt;br /&gt;
For the Text Box question type, enter the Input Box length and the Maximum text length of text to be entered by respondent.&lt;br /&gt;
&lt;br /&gt;
Default values are 20 characters for the Input Box width and 25 characters for the maximum length of text entered.&lt;br /&gt;
&lt;br /&gt;
===Yes/No===&lt;br /&gt;
&lt;br /&gt;
==Manage questions==&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Manage questions&#039;&#039;&#039; section of the Edit Questions page, you can conduct a number of operations on a Questionnaire&#039;s questions. Normally you should never add questions or delete questions in a questionnaire that is live in a moodle course, and which some students may have already responded to.&lt;br /&gt;
&lt;br /&gt;
You can Move a question to a different position in the Questionnaire. If your questionnaire contains some &amp;quot;conditional branching&amp;quot; questions, you may not be able to move some of the parent or child questions to some positions which would ruin the branching.&lt;br /&gt;
&lt;br /&gt;
You can Edit a question, but again, be extra careful when editing questions once students have started to complete a questionnaire.&lt;br /&gt;
&lt;br /&gt;
If you try to Delete a child or parent question (in a Conditional branching questionnaire), you will be warned of the possible consequences of those deletions.&lt;br /&gt;
&lt;br /&gt;
By clicking on the Green or Red dots, you can switch the &amp;quot;Response required&amp;quot; status of questions.&lt;br /&gt;
&lt;br /&gt;
Please note that the numbers in front of each question in this interface are &#039;&#039;not&#039;&#039; the question numbers that will be displayed when answering the questionnaire. Here, these numbers indicate the question&#039;s position, and even non-real questions such as Labels and Page Breaks have a position number.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
[[es:Editando preguntas de un cuestionario]]&lt;br /&gt;
[[fr:Ajouter_des_questions]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=135997</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=135997"/>
		<updated>2019-11-21T22:04:13Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Inserting RegExp sub-questions in Cloze type questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analysing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
The RegExp Short Answer question is meant to be used with questions requiring &#039;&#039;&#039;natural language&#039;&#039;&#039; answers. This question type is not well-suited to questions requiring mathematical, scientific, programming &amp;quot;languages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.5 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
Similar to the &#039;&#039;short answer&#039;&#039; core question type instructions, &amp;quot;Normally the answer box appears below the question text. However, if you include five or more underscores in the text, the input box will be placed there.&amp;quot; This inline input feature has recently been made available to the Moodle mobile version for &amp;quot;short answer&amp;quot; questions. It is now available for the &amp;quot;regexp&amp;quot; question type as well.&lt;br /&gt;
&lt;br /&gt;
If you enter this regexp question text: The ____________ sat on the white mat.&lt;br /&gt;
&lt;br /&gt;
This is what it will look like in a moodle mobile quiz:&lt;br /&gt;
&lt;br /&gt;
[[Image:2019-06-04_18-40-30.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/MOODLE_38_STABLE/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/MOODLE_38_STABLE/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Interactive_Content_-_H5P_activity&amp;diff=135373</id>
		<title>Interactive Content - H5P activity</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Interactive_Content_-_H5P_activity&amp;diff=135373"/>
		<updated>2019-09-07T14:28:31Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Activities available for creation from inside the plugin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Activity&lt;br /&gt;
|entry = https://moodle.org/plugins/mod_hvp&lt;br /&gt;
|tracker = https://github.com/h5p/h5p-moodle-plugin/issues&lt;br /&gt;
|discussion = https://h5p.org/forum&lt;br /&gt;
|maintainer = [[User:Frode Petterson|Frode Petterson]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Highlights==&lt;br /&gt;
* H5P gives you access to lots of different interactive content types (see [[#Activities_available_for_creation_from_inside_the_plugin| &#039;Activities available for creation from inside the plugin&#039;]] below).&lt;br /&gt;
* H5P allows you to easily share and reuse content.&lt;br /&gt;
** To reuse content, you just download the H5P you would like to edit and make your changes – e.g. translate to a new language or adjust it to a new situation.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
===Supercharge your website with H5P===&lt;br /&gt;
* H5P makes it easy to create, share and reuse HTML5 content and applications. &lt;br /&gt;
* H5P empowers creatives to create rich and interactive web experiences more efficiently - all you need is a web browser and a web site with an H5P plugin.&lt;br /&gt;
{{Note|Moodle itself can embedd [[Media embedding|HTML5 media]].}}&lt;br /&gt;
&lt;br /&gt;
===Mobile friendly content===&lt;br /&gt;
* Publish once, view and interact on all screens. &lt;br /&gt;
* H5P content is responsive and mobile friendly. &lt;br /&gt;
* Users experience the same rich, interactive content on computers, smartphones and tablets alike.&lt;br /&gt;
&lt;br /&gt;
===Share rich content===&lt;br /&gt;
* H5P enables existing CMSs and LMSs (such as Moodle) to create richer content. &lt;br /&gt;
* With H5P, authors may create and edit interactive videos, presentations, games, advertisements and more. &lt;br /&gt;
* Content may be imported and exported. &lt;br /&gt;
** All that is needed to view or edit H5P content is a web browser. &lt;br /&gt;
* Rich content, applications and content components may be shared on H5P.org.&lt;br /&gt;
&lt;br /&gt;
===Free to use===&lt;br /&gt;
* H5P is a completely free and open technology, licensed with the [https://en.wikipedia.org/wiki/MIT_License MIT license]. &lt;br /&gt;
* Demos/downloads, tutorials and documentation is available for users who want to join the community.&lt;br /&gt;
&lt;br /&gt;
==Links to examples and downloads==&lt;br /&gt;
* [https://h5p.org/presentation Course Presentation]&lt;br /&gt;
* [https://h5p.org/interactive-video Interactive Video]&lt;br /&gt;
* [https://h5p.org/memory-game Memory Game]&lt;br /&gt;
* Visit the [https://h5p.org/content-types-and-applications H5P content types and applications] page for more examples and downloads (see the download link inside the red rectangle in the following image).&lt;br /&gt;
[[File:H5P download an activity.png|600px]]&lt;br /&gt;
&lt;br /&gt;
==Compatible Moodle versions== &lt;br /&gt;
Moodle 2.7 to 3.6&lt;br /&gt;
&lt;br /&gt;
==Potential privacy issues==&lt;br /&gt;
The plugin is set up to automatically download content types and provide anonymous usage data which can be disabled through settings.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
==== Get the plugin ====&lt;br /&gt;
* From the [https://moodle.org/plugins/mod_hvp Moodle plugins database]&lt;br /&gt;
==== Install the plugin ====&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation&lt;br /&gt;
==== Moodle Mobile App compatibility ====&lt;br /&gt;
&lt;br /&gt;
H5P contents are compatible with the Mobile App provided these 2 parameters have been set in Admin.&lt;br /&gt;
# Site administration &amp;gt; Mobile app &amp;gt; Mobile settings &amp;gt; Enable web services for mobile devices (of course!)&lt;br /&gt;
# Site administration &amp;gt; Security &amp;gt; HTTP security &amp;gt; Allow frame embedding &lt;br /&gt;
&#039;&#039;Note 1.-&#039;&#039; The help text in this 2nd parameter displays a wrong piece of information. It reads &amp;quot;&#039;&#039;Please, note also that for the mobile app this setting is ignored and frame embedding is always allowed.&#039;&#039;&amp;quot; This is not true for H5P, Frame embedding &#039;&#039;&#039;must&#039;&#039;&#039; be enabled.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note 2.-&#039;&#039; If the admin has forgotten to enable this setting, in the Mobile App 2 different messages will be displayed to the end-user, according to their role (or rather their capacities).&lt;br /&gt;
* student role: &#039;&#039;This site is not configured properly for displaying mobile H5P content. Please contact a site administrator.&#039;&#039;&lt;br /&gt;
* admin role: &#039;&#039;Iframe embedding must be enabled in order to display H5P content in the mobile app. You can enable it by checking Allow frame embedding&amp;quot; in Site Administration / Security / Http Security&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
===Display Options===&lt;br /&gt;
You can enable/disable:&lt;br /&gt;
* Display action bar and frame&lt;br /&gt;
* Download button&lt;br /&gt;
* Copyright button&lt;br /&gt;
&lt;br /&gt;
=== Uploading or Creating an activity===&lt;br /&gt;
[[File:H5P upload an activity.png|400px]]&lt;br /&gt;
* If you choose to &#039;Upload&#039; an activity, you can choose a (.h5p) file or drag and drop one into the designated area.&lt;br /&gt;
[[File:H5P upload a previously downloaded h5p activity.png|100px]]&lt;br /&gt;
&lt;br /&gt;
* You can easily create an interactive activity with the built-in editor inside the plugin.&lt;br /&gt;
&lt;br /&gt;
[[File:H5P create an activity.png|400px]]&lt;br /&gt;
* If you choose to &#039;Create&#039; an activity, the Editor drop-down list will let you choose any one of the following:&lt;br /&gt;
&lt;br /&gt;
===Activities available for creation from inside the plugin===&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/accordion Accordion] - An accordion content type allowing users to add accessible [https://en.wikipedia.org/wiki/WAI-ARIA WAI - ARIA] enabled accordions. WAI - ARIA is used to increase the accessibility of web pages, in particular, dynamic content and user interface components developed with Ajax, HTML, JavaScript and related technologies.&lt;br /&gt;
[[File:H5P example accordion.png|400px]]&lt;br /&gt;
{{Note| The images pasted inside the text area will not show up in the final activity, only the text will be shown.}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/appear.in appear.in] for Chat and Talk - A video conference content type allowing authors to set up conference rooms.&lt;br /&gt;
[[File:H5P example appear_in.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* Audio - An easy to use audio player.&lt;br /&gt;
[[File:H5P example audio.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/node/6729 Chart] - A chart content type allowing users to create pie charts and bar charts with H5P, to present simple statistical data graphically without creating the artwork manually.&lt;br /&gt;
[[File:H5P example chart.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/collage Collage] - A photo collage content type allowing users to set up multiple photos in a custom layout using only a web browser in order to show off their photos in a tasteful way.&lt;br /&gt;
[[File:H5P example collage.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/presentation Course presentation] - A presentation content type which allows users to add multiple choice, fill in the blanks, texts and other types of interactions to their presentations using only a web browser in order to make engaging presentations.&lt;br /&gt;
[[File:H5P example course presentation.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/dialog-cards Dialog Cards] - A content type allowing authors to create great language learning resources with H5P.&lt;br /&gt;
[[File:H5P example dialog cards.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/documentation-tool Documentation Tool] - A content type allowing authors to create guides for structured writing processes with H5P.&lt;br /&gt;
[[File:H5P example documentation tool.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/drag-and-drop Drag and Drop] - A drag and drop question type allowing creatives to create many forms of drag and drop using only a web browser in order to make engaging challenges using H5P.&lt;br /&gt;
[[File:H5P example drag and drop.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/drag-the-words Drag the Words] - A question type allowing creatives to create text based challenges where users are to drag words into blanks in sentences. Excellent for language training.&lt;br /&gt;
[[File:H5P example drag the words.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/fill-in-the-blanks Fill in the Blanks] - A question type allowing creatives to create fill in the blanks, also known as [[Embedded Answers (Cloze) question type|cloze]] tests.&lt;br /&gt;
[[File:H5P example fill in the blanks.png|400px]]&lt;br /&gt;
{{Note|Moodle has two additional plugins suitable for easily making cloze questions using the Moodle [[Text editor|text editors]]: the [[Cloze editor for TinyMCE]] and the [[Cloze editor for Atto]].}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/image-hotspot-question Find the Hotspot] - A question type allowing creatives to create an image based test where the learner is to find the correct spot on an image. Use this content type with the H5P plugin to challenge your users.&lt;br /&gt;
[[File:H5P example find the hotspot.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/flashcards Flashcards] - A content type allowing creatives to create flashcards. Flashcards are often used in language learning for drilling words and expressions. Flashcards can also be used to present math problems or help learners remember facts such as historical dates, formulas or names. &lt;br /&gt;
[[File:H5P example flashcards.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* Greeting Card - To easily create a greeting card.&lt;br /&gt;
[[File:H5P example greeting card.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/node/2398 Guess the Answer] - A content type allowing creatives to create challenges where the user is to guess an answer based on a picture. &lt;br /&gt;
[[File:H5P example guess the answer.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/iframe-embedder Iframe Embedder] - The Iframe embedder makes it easy to make an H5P of already existing JavaScript applications.&lt;br /&gt;
[[File:H5P example iframe embedder.png|400px]]&lt;br /&gt;
{{Note|Moodle itself can use [[PhET simulations]]. You can embedd them in a page or inside a question in a quiz.}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/image-hotspots Image Hotspots] - A content type allowing creatives to add hotspots to images. Hotspots may reveal texts, images and videos when clicked.&lt;br /&gt;
[[File:H5P example image hotspots.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/interactive-video Interactive Video] - An interactive video content type allowing users to add multiple choice and  fill in the blank questions, pop-up text and other types of interactions to their videos using only a web browser. Make your videos more engaging.&lt;br /&gt;
[[File:H5P example interactive video.png|400px]]&lt;br /&gt;
&lt;br /&gt;
[https://h5p.org/sites/default/files/front-page-demo.mp4 Click here to link to an interactive video demo]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/mark-the-words Mark the Words] - A question type allowing creatives to create challenges where the user is to mark specific types of verbs in a text.&lt;br /&gt;
[[File:H5P example mark the words.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/memory-game Memory Game] - A memory game content type allowing authors to add their own images (and optional text) to a memory game. To play the game, users search for image pairs, which will display a specified text message once a matching pair has been found.&lt;br /&gt;
[[File:H5P memory game 001.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/multichoice Multiple Choice] - A question type allowing creatives to create challenges where the user is to identify one ore more correct choices. &lt;br /&gt;
[[File:H5P example multiple choice.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/question-set Question Set] - A content type allowing creatives to create quizzes. Many question types are supported like multiple choice, fill in the blanks, drag the words, mark the words and regular drag and drop.&lt;br /&gt;
[[File:H5P example question set..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/single-choice-set Single Choice Set] - A content type allowing creatives to create simple and smoot quizzes consisting of single choice questions.&lt;br /&gt;
[[File:H5P example single choice set..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/summary Summary] - A summary builder. This content type allows creatives to create challenges where the user is to choose between statements and build the correct summary.&lt;br /&gt;
[[File:H5P example summary..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/timeline Timeline] - A content type allowing creatives to create interactive timelines.&lt;br /&gt;
[[File:H5P example timeline..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/twitter-user-feed Twitter User feed] - A Twitter feed.&lt;br /&gt;
[[File:H5P example twitter user feed..png|400px]]&lt;br /&gt;
&lt;br /&gt;
== See also==&lt;br /&gt;
* [https://h5p.org/ H5P] homepage&lt;br /&gt;
* [https://h5p.org/forum forum] for discussing H5P&lt;br /&gt;
* [https://github.com/h5p/h5p-moodle-plugin source code] repository&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Audio]]&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
[[Category:Language teaching]]&lt;br /&gt;
[[Category:Mathematics]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actividad Contenido Interactivo - H5P]]&lt;br /&gt;
[[fr:H5P]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Interactive_Content_-_H5P_activity&amp;diff=134718</id>
		<title>Interactive Content - H5P activity</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Interactive_Content_-_H5P_activity&amp;diff=134718"/>
		<updated>2019-07-06T14:25:56Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Activity&lt;br /&gt;
|entry = https://moodle.org/plugins/mod_hvp&lt;br /&gt;
|tracker = https://github.com/h5p/h5p-moodle-plugin/issues&lt;br /&gt;
|discussion = https://h5p.org/forum&lt;br /&gt;
|maintainer = [[User:Frode Petterson|Frode Petterson]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Highlights==&lt;br /&gt;
* H5P gives you access to lots of different interactive content types (see [[#Activities_available_for_creation_from_inside_the_plugin| &#039;Activities available for creation from inside the plugin&#039;]] below).&lt;br /&gt;
* H5P allows you to easily share and reuse content.&lt;br /&gt;
** To reuse content, you just download the H5P you would like to edit and make your changes – e.g. translate to a new language or adjust it to a new situation.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
===Supercharge your website with H5P===&lt;br /&gt;
* H5P makes it easy to create, share and reuse HTML5 content and applications. &lt;br /&gt;
* H5P empowers creatives to create rich and interactive web experiences more efficiently - all you need is a web browser and a web site with an H5P plugin.&lt;br /&gt;
{{Note|Moodle itself can embedd [[Media embedding|HTML5 media]].}}&lt;br /&gt;
&lt;br /&gt;
===Mobile friendly content===&lt;br /&gt;
* Publish once, view and interact on all screens. &lt;br /&gt;
* H5P content is responsive and mobile friendly. &lt;br /&gt;
* Users experience the same rich, interactive content on computers, smartphones and tablets alike.&lt;br /&gt;
&lt;br /&gt;
===Share rich content===&lt;br /&gt;
* H5P enables existing CMSs and LMSs (such as Moodle) to create richer content. &lt;br /&gt;
* With H5P, authors may create and edit interactive videos, presentations, games, advertisements and more. &lt;br /&gt;
* Content may be imported and exported. &lt;br /&gt;
** All that is needed to view or edit H5P content is a web browser. &lt;br /&gt;
* Rich content, applications and content components may be shared on H5P.org.&lt;br /&gt;
&lt;br /&gt;
===Free to use===&lt;br /&gt;
* H5P is a completely free and open technology, licensed with the [https://en.wikipedia.org/wiki/MIT_License MIT license]. &lt;br /&gt;
* Demos/downloads, tutorials and documentation is available for users who want to join the community.&lt;br /&gt;
&lt;br /&gt;
==Links to examples and downloads==&lt;br /&gt;
* [https://h5p.org/presentation Course Presentation]&lt;br /&gt;
* [https://h5p.org/interactive-video Interactive Video]&lt;br /&gt;
* [https://h5p.org/memory-game Memory Game]&lt;br /&gt;
* Visit the [https://h5p.org/content-types-and-applications H5P content types and applications] page for more examples and downloads (see the download link inside the red rectangle in the following image).&lt;br /&gt;
[[File:H5P download an activity.png|600px]]&lt;br /&gt;
&lt;br /&gt;
==Compatible Moodle versions== &lt;br /&gt;
Moodle 2.7 to 3.1&lt;br /&gt;
&lt;br /&gt;
==Potential privacy issues==&lt;br /&gt;
The plugin is set up to automatically download content types and provide anonymous usage data which can be disabled through settings.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
==== Get the plugin ====&lt;br /&gt;
* From the [https://moodle.org/plugins/mod_hvp Moodle plugins database]&lt;br /&gt;
==== Install the plugin ====&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation&lt;br /&gt;
==== Moodle Mobile App compatibility ====&lt;br /&gt;
&lt;br /&gt;
H5P contents are compatible with the Mobile App provided these 2 parameters have been set in Admin.&lt;br /&gt;
# Site administration &amp;gt; Mobile app &amp;gt; Mobile settings &amp;gt; Enable web services for mobile devices (of course!)&lt;br /&gt;
# Site administration &amp;gt; Security &amp;gt; HTTP security &amp;gt; Allow frame embedding &lt;br /&gt;
&#039;&#039;Note 1.-&#039;&#039; The help text in this 2nd parameter displays a wrong piece of information. It reads &amp;quot;&#039;&#039;Please, note also that for the mobile app this setting is ignored and frame embedding is always allowed.&#039;&#039;&amp;quot; This is not true for H5P, Frame embedding &#039;&#039;&#039;must&#039;&#039;&#039; be enabled.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note 2.-&#039;&#039; If the admin has forgotten to enable this setting, in the Mobile App 2 different messages will be displayed to the end-user, according to their role (or rather their capacities).&lt;br /&gt;
* student role: &#039;&#039;This site is not configured properly for displaying mobile H5P content. Please contact a site administrator.&#039;&#039;&lt;br /&gt;
* admin role: &#039;&#039;Iframe embedding must be enabled in order to display H5P content in the mobile app. You can enable it by checking Allow frame embedding&amp;quot; in Site Administration / Security / Http Security&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
===Display Options===&lt;br /&gt;
You can enable/disable:&lt;br /&gt;
* Display action bar and frame&lt;br /&gt;
* Download button&lt;br /&gt;
* Copyright button&lt;br /&gt;
&lt;br /&gt;
=== Uploading or Creating an activity===&lt;br /&gt;
[[File:H5P upload an activity.png|400px]]&lt;br /&gt;
* If you choose to &#039;Upload&#039; an activity, you can choose a (.h5p) file or drag and drop one into the designated area.&lt;br /&gt;
[[File:H5P upload a previously downloaded h5p activity.png|100px]]&lt;br /&gt;
&lt;br /&gt;
* You can easily create an interactive activity with the built-in editor inside the plugin.&lt;br /&gt;
&lt;br /&gt;
[[File:H5P create an activity.png|400px]]&lt;br /&gt;
* If you choose to &#039;Create&#039; an activity, the Editor drop-down list will let you choose any one of the following:&lt;br /&gt;
&lt;br /&gt;
===Activities available for creation from inside the plugin===&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/accordion Accordion] - An accordion content type allowing users to add accessible [https://en.wikipedia.org/wiki/WAI-ARIA WAI - ARIA] enabled accordions. WAI - ARIA is used to increase the accessibility of web pages, in particular, dynamic content and user interface components developed with Ajax, HTML, JavaScript and related technologies.&lt;br /&gt;
[[File:H5P example accordion.png|400px]]&lt;br /&gt;
{{Note| The images pasted inside the text area will not show up in the final activity, only the text will be show.}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/appear.in appear.in] for Chat and Talk - A video conference content type allowing authors to set up conference rooms.&lt;br /&gt;
[[File:H5P example appear_in.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* Audio - An easy to use audio player.&lt;br /&gt;
[[File:H5P example audio.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/node/6729 Chart] - A chart content type allowing users to create pie charts and bar charts with H5P, to present simple statistical data graphically without creating the artwork manually.&lt;br /&gt;
[[File:H5P example chart.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/collage Collage] - A photo collage content type allowing users to set up multiple photos in a custom layout using only a web browser in order to show off their photos in a tasteful way.&lt;br /&gt;
[[File:H5P example collage.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/presentation Course presentation] - A presentation content type which allows users to add multiple choice, fill in the blanks, texts and other types of interactions to their presentations using only a web browser in order to make engaging presentations.&lt;br /&gt;
[[File:H5P example course presentation.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/dialog-cards Dialog Cards] - A content type allowing authors to create great language learning resources with H5P.&lt;br /&gt;
[[File:H5P example dialog cards.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/documentation-tool Documentation Tool] - A content type allowing authors to create guides for structured writing processes with H5P.&lt;br /&gt;
[[File:H5P example documentation tool.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/drag-and-drop Drag and Drop] - A drag and drop question type allowing creatives to create many forms of drag and drop using only a web browser in order to make engaging challenges using H5P.&lt;br /&gt;
[[File:H5P example drag and drop.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/drag-the-words Drag the Words] - A question type allowing creatives to create text based challenges where users are to drag words into blanks in sentences. Excellent for language training.&lt;br /&gt;
[[File:H5P example drag the words.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/fill-in-the-blanks Fill in the Blanks] - A question type allowing creatives to create fill in the blanks, also known as [[Embedded Answers (Cloze) question type|cloze]] tests.&lt;br /&gt;
[[File:H5P example fill in the blanks.png|400px]]&lt;br /&gt;
{{Note|Moodle has two additional plugins suitable for easily making cloze questions using the Moodle [[Text editor|text editors]]: the [[Cloze editor for TinyMCE]] and the [[Cloze editor for Atto]].}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/image-hotspot-question Find the Hotspot] - A question type allowing creatives to create an image based test where the learner is to find the correct spot on an image. Use this content type with the H5P plugin to challenge your users.&lt;br /&gt;
[[File:H5P example find the hotspot.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/flashcards Flashcards] - A content type allowing creatives to create flashcards.&lt;br /&gt;
[[File:H5P example flashcards.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* Greeting Card - To easily create a greeting card.&lt;br /&gt;
[[File:H5P example greeting card.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/node/2398 Guess the Answer] - A content type allowing creatives to create challenges where the user is to guess an answer based on a picture. &lt;br /&gt;
[[File:H5P example guess the answer.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/iframe-embedder Iframe Embedder] - The Iframe embedder makes it easy to make an H5P of already existing JavaScript applications.&lt;br /&gt;
[[File:H5P example iframe embedder.png|400px]]&lt;br /&gt;
{{Note|Moodle itself can use [[PhET simulations]]. You can embedd them in a page or inside a question in a quiz.}}&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/image-hotspots Image Hotspots] - A content type allowing creatives to add hotspots to images. Hotspots may reveal texts, images and videos when clicked.&lt;br /&gt;
[[File:H5P example image hotspots.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/interactive-video Interactive Video] - An interactive video content type allowing users to add multiple choice and  fill in the blank questions, pop-up text and other types of interactions to their videos using only a web browser. Make your videos more engaging.&lt;br /&gt;
[[File:H5P example interactive video.png|400px]]&lt;br /&gt;
&lt;br /&gt;
[https://h5p.org/sites/default/files/front-page-demo.mp4 Click here to link to an interactive video demo]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/mark-the-words Mark the Words] - A question type allowing creatives to create challenges where the user is to mark specific types of verbs in a text.&lt;br /&gt;
[[File:H5P example mark the words.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/memory-game Memory Game] - A memory game content type allowing authors to add their own images (and optional text) to a memory game. To play the game, users search for image pairs, which will display a specified text message once a matching pair has been found.&lt;br /&gt;
[[File:H5P memory game 001.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/multichoice Multiple Choice] - A question type allowing creatives to create challenges where the user is to identify one ore more correct choices. &lt;br /&gt;
[[File:H5P example multiple choice.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/question-set Question Set] - A content type allowing creatives to create quizzes. Many question types are supported like multiple choice, fill in the blanks, drag the words, mark the words and regular drag and drop.&lt;br /&gt;
[[File:H5P example question set..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/single-choice-set Single Choice Set] - A content type allowing creatives to create simple and smoot quizzes consisting of single choice questions.&lt;br /&gt;
[[File:H5P example single choice set..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/summary Summary] - A summary builder. This content type allows creatives to create challenges where the user is to choose between statements and build the correct summary.&lt;br /&gt;
[[File:H5P example summary..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/timeline Timeline] - A content type allowing creatives to create interactive timelines.&lt;br /&gt;
[[File:H5P example timeline..png|400px]]&lt;br /&gt;
&lt;br /&gt;
* [https://h5p.org/twitter-user-feed Twitter User feed] - A Twitter feed.&lt;br /&gt;
[[File:H5P example twitter user feed..png|400px]]&lt;br /&gt;
&lt;br /&gt;
== See also==&lt;br /&gt;
* [https://h5p.org/ H5P] homepage&lt;br /&gt;
* [https://h5p.org/forum forum] for discussing H5P&lt;br /&gt;
* [https://github.com/h5p/h5p-moodle-plugin source code] repository&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Audio]]&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actividad Contenido Interactivo - H5P]]&lt;br /&gt;
[[fr:H5P]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=134201</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=134201"/>
		<updated>2019-06-04T16:52:02Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* In the Mobile App */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analysing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
The RegExp Short Answer question is meant to be used with questions requiring &#039;&#039;&#039;natural language&#039;&#039;&#039; answers. This question type is not well-suited to questions requiring mathematical, scientific, programming &amp;quot;languages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.5 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
Similar to the &#039;&#039;short answer&#039;&#039; core question type instructions, &amp;quot;Normally the answer box appears below the question text. However, if you include five or more underscores in the text, the input box will be placed there.&amp;quot; This inline input feature has recently been made available to the Moodle mobile version for &amp;quot;short answer&amp;quot; questions. It is now available for the &amp;quot;regexp&amp;quot; question type as well.&lt;br /&gt;
&lt;br /&gt;
If you enter this regexp question text: The ____________ sat on the white mat.&lt;br /&gt;
&lt;br /&gt;
This is what it will look like in a moodle mobile quiz:&lt;br /&gt;
&lt;br /&gt;
[[Image:2019-06-04_18-40-30.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=134200</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=134200"/>
		<updated>2019-06-04T16:50:58Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* In the Mobile App */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analysing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
The RegExp Short Answer question is meant to be used with questions requiring &#039;&#039;&#039;natural language&#039;&#039;&#039; answers. This question type is not well-suited to questions requiring mathematical, scientific, programming &amp;quot;languages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.5 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
Similar to the &#039;&#039;short answer&#039;&#039; core question type instructions, &amp;quot;Normally the answer box appears below the question text. However, if you include five or more underscores in the text, the input box will be placed there.&amp;quot; This inline input feature has recently been made available to the Moodle mobile version for &amp;quot;short answer&amp;quot; questions. It is now available for the &amp;quot;regexp&amp;quot; question type as well.&lt;br /&gt;
If you enter this regexp question text: The ____________ sat on the white mat.&lt;br /&gt;
This is what it will look like in a moodle mobile quiz:&lt;br /&gt;
&lt;br /&gt;
[[Image:2019-06-04_18-40-30.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:2019-06-04_18-40-30.jpg&amp;diff=134199</id>
		<title>File:2019-06-04 18-40-30.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:2019-06-04_18-40-30.jpg&amp;diff=134199"/>
		<updated>2019-06-04T16:48:26Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133159</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133159"/>
		<updated>2019-02-24T16:26:11Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* The RegExp Short Answer Question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analysing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
The RegExp Short Answer question is meant to be used with questions requiring &#039;&#039;&#039;natural language&#039;&#039;&#039; answers. This question type is not well-suited to questions requiring mathematical, scientific, programming &amp;quot;languages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.5 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133089</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133089"/>
		<updated>2019-02-02T21:43:47Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* In the Mobile App */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.5 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133058</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133058"/>
		<updated>2019-01-27T15:54:31Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.1 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133016</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133016"/>
		<updated>2019-01-19T15:55:51Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Detecting missing required words or character strings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\bblue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.1 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133015</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133015"/>
		<updated>2019-01-19T15:30:55Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===In the Mobile App===&lt;br /&gt;
Starting with the Moodle 3.1 version, RegExp includes code for the Moodle Mobile App. If you access a quiz with the mobile app that contains RegExp questions it will be automatically loaded as a remote add-on.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp05.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp05.jpg&amp;diff=133014</id>
		<title>File:regexp05.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp05.jpg&amp;diff=133014"/>
		<updated>2019-01-19T15:22:14Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133013</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133013"/>
		<updated>2019-01-19T11:16:58Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Automatic formatted extra feedback */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted (correct but misplaced words) are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted (Wrong words) are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please note that the colour scheme has been changed starting with the Moodle 3.1 version of RegExp.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133012</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133012"/>
		<updated>2019-01-19T11:14:43Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Feedback given by the Help button */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word/punctuation&#039;&#039;&#039; button to buy/get a letter/word/punctuation mark, that letter, word or punctuation mark is added to their response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;Response history&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word/punctuation mark was added.&lt;br /&gt;
----&lt;br /&gt;
[[Image:regexp03.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133011</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133011"/>
		<updated>2019-01-19T11:10:42Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Automatic formatted extra feedback */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the colour associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are displayed on a green background;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are displayed on a red background.&lt;br /&gt;
The meaning of those colours is explained below the feedback with the 2 labels &amp;quot;Wrong words&amp;quot; and &amp;quot;Misplaced words&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp04.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp04.jpg&amp;diff=133010</id>
		<title>File:regexp04.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp04.jpg&amp;diff=133010"/>
		<updated>2019-01-19T11:07:03Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp03.jpg&amp;diff=133009</id>
		<title>File:regexp03.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp03.jpg&amp;diff=133009"/>
		<updated>2019-01-19T11:06:41Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp02.jpg&amp;diff=133008</id>
		<title>File:regexp02.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp02.jpg&amp;diff=133008"/>
		<updated>2019-01-19T11:03:37Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133007</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133007"/>
		<updated>2019-01-18T22:38:56Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133002</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=133002"/>
		<updated>2019-01-18T18:05:21Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Editing a regular expression question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp settings 01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word or punctuation mark (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The &amp;quot;Word or Punctuation&amp;quot; help mode is a new feature starting in Moodle 3.1.&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; or &amp;quot;Buy next word or punctuation&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot; or &amp;quot;Get next word or punctuation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp_settings_01.jpg&amp;diff=133001</id>
		<title>File:regexp settings 01.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp_settings_01.jpg&amp;diff=133001"/>
		<updated>2019-01-18T17:58:39Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132995</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132995"/>
		<updated>2019-01-18T10:18:06Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort vom Typ regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132946</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132946"/>
		<updated>2019-01-10T22:22:05Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Configuring an Export Glossary to Quiz block */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions. Starting with the Moodle 3.6 version, it is also possible to export entries to the &#039;&#039;&#039;Gapfill&#039;&#039;&#039; contributed question type, if that plugin is installed on your Moodle site, of course.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## If the &#039;&#039;&#039;&#039;&#039;Gapfill&#039;&#039;&#039;&#039;&#039; question type is installed on your moodle site, it will appear as an option in the -- Select question type -- drop-down list. If you select the Gapfill question type, one more drop-down list will be displayed, where you can choose from the 3 display modes for Gapfill: gapfill, dragdrop or dropdown. If you select the gapfill or the dragdrop modes, you&#039;ll have a further option of fixed gap size. See the [[Gapfill_question_type|Gapfill question documentation]] for more info.&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# In Administration block, click Questions to go to the Questions bank&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Exporter un glossaire vers un Test]]&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132945</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132945"/>
		<updated>2019-01-10T22:03:18Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions. Starting with the Moodle 3.6 version, it is also possible to export entries to the &#039;&#039;&#039;Gapfill&#039;&#039;&#039; contributed question type, if that plugin is installed on your Moodle site, of course.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# In Administration block, click Questions to go to the Questions bank&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Exporter un glossaire vers un Test]]&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Embedded_Answers_(Cloze)_question_type&amp;diff=132871</id>
		<title>Embedded Answers (Cloze) question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Embedded_Answers_(Cloze)_question_type&amp;diff=132871"/>
		<updated>2018-12-21T15:04:26Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Detailed syntax explanations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questions}}&lt;br /&gt;
&#039;&#039;&#039;Embedded answers (Cloze)&#039;&#039;&#039; questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
Until mid2013, there was no graphical interface to create these questions within your Moodle site - you needed to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
You can link to an external web site that does create these questions from a graphical interface, see the &#039;&#039;[http://projects.ael.uni-tuebingen.de/quiz/htmlarea/index.php Online Cloze Question quiz generator]&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
There is an Excel-based [http://hbwubecc.wixsite.com/jordan/tools Cloze and GIFT Generator] that was presented at the 2017 Moodle Moot Japan.&lt;br /&gt;
&lt;br /&gt;
There is a [[Cloze editor for TinyMCE]] that will let you create these questions from a graphical interface within your Moodle site, but it will overwrite your current HTML editor and only works with the [[TinyMCE editor]] but not with [[Atto]]. In 2016 a [[Cloze editor for Atto]] additional plugin was created.&lt;br /&gt;
&lt;br /&gt;
Lots of people suggested that [[Hot Potatoes]] software is the easiest way to create Embedded answer (Cloze) questions.  Once you have created your questions on your PC, you can then import them into Moodle&#039;s quiz module.&lt;br /&gt;
&lt;br /&gt;
However, the flexibility of the Cloze question type is hard to equal and despite the minor coding that you need to create the questions, it has great worth in the Moodle Quiz.&lt;br /&gt;
&lt;br /&gt;
==Question set-up==&lt;br /&gt;
&lt;br /&gt;
#Select the question category&lt;br /&gt;
#Give the question a descriptive name - this allows you to identify it in the question bank.&lt;br /&gt;
#Enter the passage of text (in Moodle format - see [[Embedded_Answers_%28Cloze%29_question_type#Format|Format]] below) into the &#039;question text&#039; field.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question. For the student, it appears immediately above the question text.&lt;br /&gt;
#Set the &#039;default question grade&#039; (i.e. the maximum number of marks for this question).&lt;br /&gt;
#Set the &#039;Penalty factor&#039; (see [[Embedded_Answers_%28Cloze%29_question_type#Penalty_factor|Penalty factor]] below).&lt;br /&gt;
#If you wish, add general feedback. This is text that appears to the student after he/she has answered the question.&lt;br /&gt;
#The editor has been modified and allows you to test if your syntax is good. The different questions elements decoded will be displayed and syntax errors pinpoint. However, it cannot check if the question decoded is two questions in one because of an error syntax.&lt;br /&gt;
#Click Save changes to add the question to the category.&lt;br /&gt;
&lt;br /&gt;
=== Penalty factor ===&lt;br /&gt;
&lt;br /&gt;
The &#039;penalty factor&#039; only applies when the question is used in a quiz using adaptive mode - i.e. where the student is allowed multiple attempts at a question even within the same attempt at the quiz. If the penalty factor is more than 0, then the student will lose that proportion of the &#039;&#039;&#039;maximum&#039;&#039;&#039; grade upon each successive attempt. For example, if the default question grade is 10, and the penalty factor is 0.2, then each successive attempt after the first one will incur a penalty of 0.2 x 10 = 2 points.  The grading for the cloze question applies the penalty to each subpart of the question as a whole.  For example, if you have three fill in the blanks each worth 1 point each, then the penalty will only be incurred on the incorrect parts, not the questions as a whole.&lt;br /&gt;
&lt;br /&gt;
==Question rendering==&lt;br /&gt;
&lt;br /&gt;
The question answer entry space or INPUT HTML ELEMENT (for Short Answer and Numerical question types) and the dropdown list or SELECT HTML ELEMENT (for multichoice) are normally displayed in-line with the text.&lt;br /&gt;
&lt;br /&gt;
The size of the entry space or INPUT HTML ELEMENT ( Short and Numerical) will be adjustable to the length of the longest answer (good or bad) + a random number (0 to 15% total length).([[User:Pierre Pichet|Pierre Pichet]] 15:37, 26 January 2008 (CST))&lt;br /&gt;
&lt;br /&gt;
The size will adjust to the length of the student response when displayed in the grading and feedback process.&lt;br /&gt;
&lt;br /&gt;
The size of the dropdown list or SELECT HTML ELEMENT (multichoice) adjusts itself automatically to the longest answer.&lt;br /&gt;
&lt;br /&gt;
==Format==&lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various sub-questions embedded within it, including&lt;br /&gt;
&lt;br /&gt;
* short answers (SHORTANSWER or SA or MW), case is unimportant,&lt;br /&gt;
* short answers (SHORTANSWER_C or SAC or MWC), case must match,&lt;br /&gt;
* numerical answers (NUMERICAL or NM),&lt;br /&gt;
* multiple choice (MULTICHOICE or MC), represented as a dropdown menu in-line in the text,&lt;br /&gt;
* multiple choice (MULTICHOICE_V or MCV), represented as a vertical column of radio buttons, or&lt;br /&gt;
* multiple choice (MULTICHOICE_H or MCH), represented as a horizontal row of radio-buttons,&lt;br /&gt;
* multiple choice (MULTIRESPONSE or MR), represented as a vertical row of checkboxes&lt;br /&gt;
* multiple choice (MULTIRESPONSE_H or MRH), represented as a horizontal row of checkboxes&lt;br /&gt;
* when the quiz question behavior shuffle option IS SET YES, the following multiple choice sub-questions elements will be shuffled,&lt;br /&gt;
* multiple choice (MULTICHOICE_S or MCS), represented as a dropdown menu in-line in the text,&lt;br /&gt;
* multiple choice (MULTICHOICE_VS or MCVS), represented as a vertical column of radio buttons, or&lt;br /&gt;
* multiple choice (MULTICHOICE_HS or MCHS), represented as a horizontal row of radio-buttons.&lt;br /&gt;
* multiple choice (MULTIRESPONSE_S or MRS), represented as a vertical row of checkboxes&lt;br /&gt;
* multiple choice (MULTIRESPONSE_HS or MRHS), represented as a horizontal row of checkboxes&lt;br /&gt;
&lt;br /&gt;
{{Note|MCS, MCVS, MCHS are new (Moodle 3.0) Cloze subquestion types with shuffling of answers. See MDL-38214.}}&lt;br /&gt;
&lt;br /&gt;
The structure of  each cloze sub-question is identical:&lt;br /&gt;
:&#039;&#039;&#039;{&#039;&#039;&#039;  start the cloze sub-question with a bracket (AltGr+7)&lt;br /&gt;
:&#039;&#039;&#039;1&#039;&#039;&#039; define a grade for each cloze by  a number (optional). This used for calculation of question grading.&lt;br /&gt;
:&#039;&#039;&#039;:SHORTANSWER:&#039;&#039;&#039; define the type of cloze sub-question. Definition is bounded by &#039;:&#039;. &lt;br /&gt;
:&#039;&#039;&#039;~&#039;&#039;&#039; is a seperator between answer options&lt;br /&gt;
:&#039;&#039;&#039;=&#039;&#039;&#039; marks a correct answer&lt;br /&gt;
:&#039;&#039;&#039;#&#039;&#039;&#039; marks the beginning of an (optional) feedback message&lt;br /&gt;
:&#039;&#039;&#039;}&#039;&#039;&#039;  close the cloze sub-question at the end with a bracket (AltGr+0)&lt;br /&gt;
&lt;br /&gt;
Now a very simple example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{1:SHORTANSWER:=Berlin} is the capital of Germany.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For full details of the format for embedded-answers questions, see the [[Embedded_Answers_%28Cloze%29_question_type#Detailed_syntax_explanations|detailed syntax explanation]] below.&lt;br /&gt;
&lt;br /&gt;
NB: Be careful when copying a cloze type question into the WYSIWYG HTML editor, as line breaks tend to get added, which destroys the question.&lt;br /&gt;
&lt;br /&gt;
If the correct answer contains } # ~ / &amp;quot; or \ you will have to escape them by putting a \ in front of each such character. But [[https://moodle.org/mod/forum/discuss.php?d=275299 this is tricky]]. The { shouldn&#039;t be escaped, this can be vital in getting TeX expressions to work. In the feedback ~ and } must be escaped otherwise it will be interpreted as &#039;&#039;the next answer&#039;&#039; or &#039;&#039;end of the short answer section&#039;&#039; respectively. Quotation signs: &amp;quot; can lead to trouble anyhow in both places. Use the HTML entity: &amp;amp; quot; (without the space between &#039;&#039;&amp;amp;&#039;&#039; and &#039;&#039;quot;&#039;&#039;). If you want to have Mathematical symbols there can be problems with the \ used in TeX expressions. One alternative can be to use [[unicode]] characters. &lt;br /&gt;
&lt;br /&gt;
See the notes further down about numerical embedded question!&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Example 1====&lt;br /&gt;
The following text creates a simple embedded-answers question:&lt;br /&gt;
&lt;br /&gt;
 Match the following cities with the correct state:&lt;br /&gt;
 * San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong}&lt;br /&gt;
 * Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK}&lt;br /&gt;
 * Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong}&lt;br /&gt;
 * Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}&lt;br /&gt;
 The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations!&lt;br /&gt;
 ~%50%Marseille#No, that is the second largest city in France (after&lt;br /&gt;
 Paris).~*#Wrong answer. The capital of France is Paris, of course.}.&lt;br /&gt;
&lt;br /&gt;
And the result will be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Cloze.gif|Cloze question type]] &lt;br /&gt;
&lt;br /&gt;
====Example 2====&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding: 1em;border: 1px dashed #FFB53A;color: black;background-color: #f9f9f9;font-family: monospace;font-size:1.2em;&amp;quot;&amp;gt;&lt;br /&gt;
This question consists of some text with an answer embedded right here {1:MULTICHOICE:Wrong answer#Feedback for this wrong answer~Another wrong answer#Feedback for the other wrong answer~=Correct answer#Feedback for correct answer~%50%Answer that gives half the credit#Feedback for half credit answer}&lt;br /&gt;
&lt;br /&gt;
and right after that you will have to deal with this short answer {1:SHORTANSWER:Wrong answer#Feedback for this wrong answer~=Correct answer#Feedback for correct answer~%50%Answer that gives half the credit#Feedback for half credit answer}&lt;br /&gt;
&lt;br /&gt;
and finally we have a floating point number {2:NUMERICAL:=23.8:0.1#Feedback for correct answer 23.8~%50%23.8:2#Feedback for half credit answer in the nearby region of the correct answer}.&lt;br /&gt;
&lt;br /&gt;
The  multichoice question can also be shown in the vertical display of the standard moodle multiple choice.&lt;br /&gt;
{2:MCV:1. Wrong answer#Feedback for this wrong answer~2. Another wrong answer#Feedback for the other wrong answer~=3. Correct answer#Feedback for correct answer~%50%4. Answer that gives half the credit#Feedback for half credit answer}&lt;br /&gt;
&lt;br /&gt;
Or in an horizontal display that is included here in a table&lt;br /&gt;
{2:MCH:a. Wrong answer#Feedback for this wrong answer~b. Another wrong answer#Feedback for the other wrong answer~=c. Correct answer#Feedback for correct answer~%50%d. Answer that gives half the credit#Feedback for half credit answer}&lt;br /&gt;
&lt;br /&gt;
A shortanswer question where case must match. Write moodle in upper case letters {1:SHORTANSWER_C:moodle#Feedback for moodle in lower case ~=MOODLE#Feedback for MOODLE in upper case ~%50%Moodle#Feedback for only first letter in upper case}&lt;br /&gt;
&lt;br /&gt;
Note that addresses like www.moodle.org and smileys :-) all work as normal:&lt;br /&gt;
&lt;br /&gt;
a) How good is this? {:MULTICHOICE:=Yes#Correct~No#We have a different opinion}&lt;br /&gt;
&lt;br /&gt;
b) What grade would you give it? {3:NUMERICAL:=3:2}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Image:Cloze example.png]]&lt;br /&gt;
&lt;br /&gt;
Some things to note:&lt;br /&gt;
* The individual embedded answers are represented by the code in braces {}.&lt;br /&gt;
* The number at the start is the &#039;weight&#039;, so in this case each answer contributes an equal share of the overall grade.&lt;br /&gt;
* The correct option in each case is preceded either by an = sign or by %100%. &lt;br /&gt;
* The text appearing after the # that follows each option is the feedback that the student will see if they choose that option.&lt;br /&gt;
* If the student enters &#039;Marseille&#039; in the final example, they score 50% of the total grade.&lt;br /&gt;
* The asterisk * preceding the &amp;quot;Wrong answer&amp;quot; feedback in the final example means that the student will see this feedback if they enter anything other than &amp;quot;Paris&amp;quot; or &amp;quot;Marseille&amp;quot;.&lt;br /&gt;
* For multiple choice vertical or horizontal rendering there is no automatic numbering, though can added at each answer.&lt;br /&gt;
&lt;br /&gt;
==Detailed syntax explanations==&lt;br /&gt;
# all question items within a cloze-type question are coded inside curled braces { }&lt;br /&gt;
# the number which appears between the opening brace and the colon {1: is the weighting of that item; if it is set at 1 for all the items, it needs not be specified, so you can have {:&lt;br /&gt;
# after the colon we have the item question type: MULTICHOICE, SHORTANSWER, NUMERICAL&lt;br /&gt;
# &#039;&#039;&#039;NOTE&#039;&#039;&#039;.- If you have installed the [https://moodle.org/plugins/qtype_regexp REGEXP question type plugin] you can also use the REGEXP question type; see [https://docs.moodle.org/38/en/Regular_Expression_Short-Answer_question_type#Inserting_RegExp_sub-questions_in_Cloze_type_questions instructions here].&lt;br /&gt;
# the syntax for MULTICHOICE and SHORTANSWER is the same; the only difference is in the displaying of the item to the student&lt;br /&gt;
# the order of the various answers is indifferent (except if you want a catch-all for wrong answers, see #13 below)&lt;br /&gt;
# a correct answer is preceded with the equal sign = or a percentage (usually %100%) - &#039;&#039;&#039;Note&#039;&#039;&#039;: [[Talk:Embedded_Answers_(Cloze)_question_type| The equal sign (=) doesn&#039;t seem to work with SHORTANSWER.]]&lt;br /&gt;
# a wrong answer is preceded with nothing or a percentage (usually %0%)but you can even use negative points by preceding with ~%-25% [not before Moodle 2.0])&lt;br /&gt;
# you can allocate some points between 0 and 100 to some answers, if you put the appropriate percentage&lt;br /&gt;
# all answers except the first one are separated from one another by the tilde ~ sign&lt;br /&gt;
# answers can be followed by an optional feedback message, preceded with the # sign; if there is no feedback message, the # sign can be present or absent, it does not matter&lt;br /&gt;
# note that the feedback message and the correct answer are displayed in a small popup window (if and when the correct and or feedback have been declared accessible to the students in the Quiz settings) upon mouse hovering. The popup window has a title &amp;quot;feedback&amp;quot; and you can use HTML tags to format your feedback. In some browsers (For example IE5.5) the form fields can cover part of the feedback windows. It can help to not have the formfields for the answers too close to each other.&lt;br /&gt;
# in the SHORTANSWER type you may want to put a catch-all (wrong) answer in order to send a &amp;quot;wrong, try again&amp;quot; feedback; you can do this by inserting an asterisk &#039;&#039;&#039;*&#039;&#039;&#039; as &#039;&#039;&#039;the very last expected answer&#039;&#039;&#039; in your formula&lt;br /&gt;
&lt;br /&gt;
==Numerical Cloze questions==	 &lt;br /&gt;
		 &lt;br /&gt;
From the student perspective, a numerical Cloze question looks just like a short-answer question or &#039;&#039;fill in the blanks&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. You can also express your answer in some different numerical formats. 23.4 23,4 (some countries use , as a decimal separator) and 2.34E+1 (meaning 2.34*10^1) would be interpreted as the same.&lt;br /&gt;
&lt;br /&gt;
=== False positives ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; the following examples of false positives do &#039;&#039;&#039;not&#039;&#039;&#039; apply to Moodle 1.8+, where you cannot use percentages or fractions as the answers in a numerical Cloze test; Moodle will generate an error if you try to save such a question. However the following may be relevant for earlier versions of Moodle.&lt;br /&gt;
&lt;br /&gt;
 More examples:	 &lt;br /&gt;
 0.5 accepts .5 0.5 ,5 0,5 0.500 5e-1 5E-1 but not 1/2 50% 	 &lt;br /&gt;
 50% accepts 50% 50.0% 5E1% 50/100 even &#039;&#039;&#039;50/1000 50&#039;&#039;&#039; but not 500/1000 0.5	 &lt;br /&gt;
 1/2 accepts 1/2 &#039;&#039;&#039;1/3 1twenty&#039;&#039;&#039; but not 2/4 0.5 0,5 3/6 50% ½	 &lt;br /&gt;
 ½ accepts ½	 &lt;br /&gt;
 HALF doesn&#039;t even accept HALF (maybe &#039;&#039;&#039;0&#039;&#039;&#039;?)	 &lt;br /&gt;
&lt;br /&gt;
If you want to accept several variants you can have them in the same {} but &#039;&#039;&#039;be careful, notice the &amp;quot;false positives&amp;quot; in bold&#039;&#039;&#039;!&lt;br /&gt;
&lt;br /&gt;
===Syntax for numerical Cloze questions===&lt;br /&gt;
&lt;br /&gt;
The format of a NUMERICAL Cloze question is similar to that of the other Cloze types and they can be mixed in the same question. As with other Cloze tests, you write your question or incomplete text, and add the Cloze code at the point where the student is supposed to enter their numerical answer.&lt;br /&gt;
&lt;br /&gt;
An example of the syntax used is shown below:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: &#039;&#039;&#039; It is preferable to write the code in &#039;source code&#039; mode. The WSIWYG editor can insert linebreaks that make the question not function. The linebreak in the example box below is for readability only! A problem with these questions is the readability of the code! :(	&lt;br /&gt;
		 &lt;br /&gt;
 {2:NUMERICAL:=23.8:0.1#Feedback for correct answer 23.8	 &lt;br /&gt;
 ~%50%23.8:2#Feedback for ½credit near correct answer}. 	 &lt;br /&gt;
	 &lt;br /&gt;
In this example:&lt;br /&gt;
* 2: is the question point weight, which means that this question has twice the weight in the final point(s) for this question as other partial answers with weight 1 (or no declared weight - you can start with {: for the default weight 1) in the same question.&lt;br /&gt;
* NUMERICAL: says what kind of question it is. It must be in CAPS. &lt;br /&gt;
* =23.8:0.1 = or %100% means correct if the answer is 23.8 with an accepted error of 0.1, then any number between 23.7 and 23.9 will be accepted as correct. (In the GIFT numerical question one can express an interval like this 13..15 or 14:1 but in Cloze only 14:1 works.)	 &lt;br /&gt;
* #Feedback for correct answer 23.8 is preceded by #&lt;br /&gt;
* ~%50%23.8:2 ~ is the separator for answer alternatives %50% means this answer would get 50% of the score that the more precise answer had gotten. Because the tolerance here is 2, 21.8 to 25.8 would get this point and feedback.&lt;br /&gt;
&lt;br /&gt;
The feedback (which is seen within a popup window when the user hovers over the answer space) is formattable with HTML tags. For example, if you want an exponent, surround it with superscript tags: &amp;amp;lt;sup&amp;amp;gt; &amp;amp;lt;/sup&amp;amp;gt;. You can even include pictures in the feedback popup, but you must clean out all &amp;quot; characters and save while still in source code mode (not WYSIWYG). So, this works in feedback popup:&lt;br /&gt;
 #See this picture:&amp;amp;lt;br&amp;amp;gt;&amp;amp;lt;img src=Something.gif /&amp;gt;}	 &lt;br /&gt;
but not this:&lt;br /&gt;
 #See this picture:&amp;amp;lt;br&amp;amp;gt;&amp;amp;lt;img src=&amp;quot;Something.gif&amp;quot; /&amp;gt;}	 &lt;br /&gt;
&lt;br /&gt;
(ALGEBRA and TEX filters don&#039;t work in the feedback popups, but they can be very useful in the question writing for math/science expressions). But you can use [[Unicode]] characters.	 &lt;br /&gt;
&lt;br /&gt;
If you want to give feedback for any answer that didn&#039;t fit the intervals you already have specified feedback for, add some BIG general intervals, like for positive answers (if they aren&#039;t bigger than 20000 you could add:	 &lt;br /&gt;
 ~%0%10000.0001:10000#Feedback for unspecified not_right answers}	 &lt;br /&gt;
This would give feedback for anything from 0.0001 to 20000.0001 (that hadn&#039;t already gotten feedback). I didn&#039;t want to include 0 since that special case as well as negative ought to have specific reactions.	 &lt;br /&gt;
 ~%0%0#Hey! It can&#039;t be zero	 &lt;br /&gt;
 ~%0%-10000.0001:10000#We just want the size here,	 &lt;br /&gt;
 so a negative value is not what we want}			 &lt;br /&gt;
&lt;br /&gt;
Numerical questions could, before version 1.7, also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like +inf, -inf, NaN etc.&lt;br /&gt;
==Importing CLOZE questions==&lt;br /&gt;
If you try importing directly as CLOZE this text:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Single line per question! Match the following cities with the correct state:&lt;br /&gt;
* San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong}&lt;br /&gt;
* Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK}&lt;br /&gt;
* Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong}&lt;br /&gt;
* Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}&lt;br /&gt;
&lt;br /&gt;
The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations!~%50%Marseille#No, that is the second largest city in France (after Paris).~*#Wrong answer. The capital of France is Paris, of course.}.&lt;br /&gt;
&lt;br /&gt;
23+ 0.8 = {2:NUMERICAL:=23.8:0.1#Feedback for correct answer 23.8 ~%50%23.8:2#Feedback for ½credit near correct answer}. 	 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You would get all three questions as different parts of &#039;&#039;&#039;ONE question&#039;&#039;&#039;. (NOTE see that there are no linebreaks between the { } !)&lt;br /&gt;
&lt;br /&gt;
Multiple CLOZE questions can be imported using the XML format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;quiz&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- question: 1  --&amp;gt;&lt;br /&gt;
&amp;lt;question type=&amp;quot;cloze&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;&amp;lt;text&amp;gt;Book Test #1&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;questiontext&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&amp;lt;![CDATA[..............]]&amp;gt;&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/questiontext&amp;gt;&lt;br /&gt;
&amp;lt;generalfeedback&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/generalfeedback&amp;gt;&lt;br /&gt;
&amp;lt;shuffleanswers&amp;gt;0&amp;lt;/shuffleanswers&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- question: 2 --&amp;gt;&lt;br /&gt;
&amp;lt;question type=&amp;quot;cloze&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;&amp;lt;text&amp;gt;Book Test #2&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;questiontext&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&amp;lt;![CDATA[............]]&amp;gt;&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/questiontext&amp;gt;&lt;br /&gt;
&amp;lt;generalfeedback&amp;gt;&lt;br /&gt;
&amp;lt;text&amp;gt;&amp;lt;/text&amp;gt;&lt;br /&gt;
&amp;lt;/generalfeedback&amp;gt;&lt;br /&gt;
&amp;lt;shuffleanswers&amp;gt;0&amp;lt;/shuffleanswers&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/quiz&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You would put the question text including CLOZE code in the  .......  spaces.&lt;br /&gt;
&lt;br /&gt;
==Online Cloze Question generator==&lt;br /&gt;
* There is a website to generate CLOZE quizzes for Moodle (1.9 and 2.x and 3.x versions) and/or to try out the CLOZE editor integration for Moodle.&lt;br /&gt;
* This editor was built at the Chair of Applied English Linguistics at Universitaet Tuebingen, Germany, by Andreas Glombitza (andiglombitza(at)googlemail.com) and Achim Skuta (achim.skuta(at)googlemail.com).&lt;br /&gt;
* The authors are currently maintaining this software and webservice as a private project.&lt;br /&gt;
&lt;br /&gt;
Website: [http://projects.ael.uni-tuebingen.de/quiz/htmlarea/index.php http://projects.ael.uni-tuebingen.de/quiz/htmlarea/index.php]&lt;br /&gt;
 &lt;br /&gt;
==Cloze editor plugin for TinyMCE==&lt;br /&gt;
* You can download a [https://moodle.org/plugins/view.php?plugin=other_cloze Moodle plugin from the Moodle plugins database] that will let you create these questions from a graphical interface within your Moodle site. There are versions available for Moodle 1.9, 2.x and 3.x.&lt;br /&gt;
&lt;br /&gt;
==Cloze editor plugin for Atto==&lt;br /&gt;
This [[Cloze editor for Atto|new plugin for Moodle 3.1+]] was developed by Daniel Thies and is available for download and install from the Moodle plugins database..&lt;br /&gt;
&lt;br /&gt;
==Question with 1 media (e.g. audio) and several subquestions==&lt;br /&gt;
As described in [https://moodle.org/mod/forum/discuss.php?d=376874 this forum post], you can easily make a question where the student inspect a media (e.g. an audio file) and then has to answer several small multiple choice questions. The example below is from a Moodle 3.5.2+ site using the new Record audio tool in the Atto editor. The Record video tool will also let you add video as part of the question, if you want to.&lt;br /&gt;
&lt;br /&gt;
[[File:CLOZE question with 1 audio and 3 sub-questions.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Questions with student notes and feedback for teacher==&lt;br /&gt;
You can easily make one/many/all question(s) with an optional field for student notes and/or feedback for the teacher, as requested in [https://moodle.org/mod/forum/discuss.php?d=353587 this forum thread]. Note that only the first MULTICHOICE question is marked, and the two optional fields do not score positive nor negative points:&lt;br /&gt;
&lt;br /&gt;
[[File:CLOZE question with student comment and teacher feedback.png]]&lt;br /&gt;
&lt;br /&gt;
The full question for the above example is:&lt;br /&gt;
&lt;br /&gt;
 Which of the following options is the right answer ?&lt;br /&gt;
 {1:MULTICHOICE_VS:~A wrong answer~Another wrong answer~Yet another wrong answer~%100%This is the only right answer}&lt;br /&gt;
 Optionally:Write a personal note: {0:SHORTANSWER:~%0%I want to have a longer input box for the note.~%100%*}&lt;br /&gt;
 Optionally:Send feedback to teacher:{0:SHORTANSWER:~%0%I want to have a longer input box for the feedback.~%100%*}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* See the [http://projects.ael.uni-tuebingen.de/quiz/htmlarea/index.php online Cloze question generator].&lt;br /&gt;
* Download the newest version of the [[Cloze editor for TinyMCE]] for Moodle 1.9 and for Moodle 2.0 to 3.3 from [https://moodle.org/plugins/view.php?plugin=tinymce_clozeeditor the Moodle plugins database]&lt;br /&gt;
* Easily edit embedded answer questions with the additional plugin [[Cloze editor for Atto]] for Moodle 2.7+&lt;br /&gt;
&lt;br /&gt;
This information was drawn from:&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=36521 Is there a guide to using the cloze format?] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=36430&amp;amp;parent=170308 Cloze-type question syntax] forum post&lt;br /&gt;
&lt;br /&gt;
[[Category:Language teaching]]&lt;br /&gt;
&lt;br /&gt;
[[de:Fragetyp Lückentext (Cloze)]]&lt;br /&gt;
[[es:Tipo de Pregunta con respuestas incrustadas (Cloze)]]&lt;br /&gt;
[[fr:Question Cloze à réponses intégrées]]&lt;br /&gt;
[[ja: 穴埋め問題 ( Cloze ) タイプ]]&lt;br /&gt;
[[zh:填空題(克漏字)]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132848</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=132848"/>
		<updated>2018-12-19T15:15:22Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Import to the quiz questions bank */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# In Administration block, click Questions to go to the Questions bank&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Exporter un glossaire vers un Test]]&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132127</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132127"/>
		<updated>2018-10-31T21:55:53Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Detecting missing required words or character strings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr].*&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r).*&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132109</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132109"/>
		<updated>2018-10-29T15:07:29Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* In Accepted Answers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132108</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132108"/>
		<updated>2018-10-29T15:06:04Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Example 5. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes a man healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;&amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132051</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132051"/>
		<updated>2018-10-05T21:42:11Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Inserting RegExp sub-questions in Cloze type questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes an ma healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;&amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
[[Image:regexp_in_cloze_question.jpg]]&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=File:regexp_in_cloze_question.jpg&amp;diff=132050</id>
		<title>File:regexp in cloze question.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=File:regexp_in_cloze_question.jpg&amp;diff=132050"/>
		<updated>2018-10-05T21:36:03Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132049</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132049"/>
		<updated>2018-10-05T21:27:22Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: Re-introduced links to the 2 hacked files for inserting REGEXP questions in CLOZE questions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes an ma healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;&amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle &#039;&#039;&#039;Cloze&#039;&#039;&#039; question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.githubusercontent.com/rezeau/moodle_multianswer_regexp_compatible/master/renderer.php&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
A more complete example. If you enter the following in the text of a Cloze question:&lt;br /&gt;
&#039;&#039;The colors of the French flag are {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}.&#039;&#039; and click the &#039;&#039;Decode and verify the question text&#039;&#039; button, you will see this:&lt;br /&gt;
&lt;br /&gt;
Question {#9} Regular expression short answer&lt;br /&gt;
 Question definition&lt;br /&gt;
 {:REGEXP:=blue, white and red#Very correct indeed!~--.*\bblue\b.*#The color of the sky is missing!~--.*(blue|red|white).*#You have not even found one of the colors of the French flag!}&lt;br /&gt;
 Default mark &lt;br /&gt;
 1&lt;br /&gt;
 Answer&lt;br /&gt;
 blue, white and red&lt;br /&gt;
 Grade&lt;br /&gt;
 1&lt;br /&gt;
 Feedback&lt;br /&gt;
 Very correct indeed!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*\bblue\b.*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 The color of the sky is missing!&lt;br /&gt;
 Answer&lt;br /&gt;
 --.*(blue|red|white).*&lt;br /&gt;
 Grade&lt;br /&gt;
 0&lt;br /&gt;
 Feedback&lt;br /&gt;
 You have not even found one of the colors of the French flag! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132032</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=132032"/>
		<updated>2018-10-02T08:27:08Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* First correct answer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = question type&lt;br /&gt;
|entry = https://moodle.org/plugins/pluginversions.php?plugin=qtype_regexp&lt;br /&gt;
|tracker = https://github.com/ndunand/moodle-qtype_regexp/issues&lt;br /&gt;
|discussion = https://moodle.org/plugins/qtype_regexp&lt;br /&gt;
|maintainer = [[user:Nicolas Dunand]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}{{Questions}}&lt;br /&gt;
===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes an ma healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;&amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost (me )?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====See also these other Moodle question types based on regular expressions====&lt;br /&gt;
* [[Pattern-match question type]]&lt;br /&gt;
* [[Preg question type]]&lt;br /&gt;
* [[Essay (auto-grade) question type]] additional plugin (NOT based on regular expressions)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;br /&gt;
[[de:Fragetyp Kurzantwort Regulärer Ausdruck]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Question_behaviours&amp;diff=132009</id>
		<title>Question behaviours</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Question_behaviours&amp;diff=132009"/>
		<updated>2018-10-01T10:04:27Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: Re-named Interactive mode to Interactive with multiple tries&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questions}}&lt;br /&gt;
==How questions behave==&lt;br /&gt;
The following question behaviours are available when [[Quiz settings|creating a quiz]] (also when previewing questions):&lt;br /&gt;
&lt;br /&gt;
;Deferred feedback&lt;br /&gt;
:Students must enter an answer to each question and then submit the entire quiz, before anything is graded or they get any feedback.&lt;br /&gt;
;Adaptive mode and Adaptive mode (no penalties)&lt;br /&gt;
:Allows students to have multiple attempts at the question before moving on to the next question. This behaviour requires that the &amp;quot;Whether correct&amp;quot; box is ticked under &amp;quot;During the attempt&amp;quot; in the &amp;quot;Review options&amp;quot; section, at a minimum. &lt;br /&gt;
;Manual grading&lt;br /&gt;
:Used for essay questions (irrespective of what the quiz is set to) but you can now choose to have every question in the quiz manually graded, if you wish.&lt;br /&gt;
;Interactive with multiple tries&lt;br /&gt;
:After submitting one answer, and reading the feedback, the student has to click a &#039;Try again&#039; button before they can try a new response.  They can be given hints to help them. Once the student has got the question right, they can no longer change their response. Once the student has got the question wrong too many times, they are just graded wrong (or partially correct) and get shown the feedback and can no longer change their answer. There can be different feedback after each try the student makes. The number of tries the student gets is the number of hints in the question definition plus one.&lt;br /&gt;
;Immediate feedback&lt;br /&gt;
:Similar to interactive mode in that the student can submit their response immediately during the quiz attempt, and get it graded. However, they can only submit one response, they cannot change it later.&lt;br /&gt;
;Deferred feedback or Immediate feedback with Certainty-based marking (CBM)&lt;br /&gt;
:With CBM, the student does not only answer the question, but they also indicate how sure they are they got the question right. The grading is adjusted by the choice of certainty, so that students have to reflect honestly on their own level of knowledge in order to get the best mark.&lt;br /&gt;
;Conditional questions&lt;br /&gt;
:If using the Interactive with multiple tries or Immediate Feedback behaviour and with the navigation method set to &#039;Free&#039;, it is possible to make the display of a question dependent on a previous question being answered first.&lt;br /&gt;
:The question editing page will display padlock icons to the right of each question.&lt;br /&gt;
&lt;br /&gt;
==Certainty-based marking==&lt;br /&gt;
When a student answers a question they also have to state how sure they are of the answer: not very (less than 67%); fairly (more than 67%) or very (more than 80%). Their grading is then adjusted according to how certain they are, which means that for example if they answered correctly but were only guessing, their mark is adjusted from 1 to 0.33. If they answered wrongly but were very sure, their mark is adjusted from 0 to -2. &lt;br /&gt;
&lt;br /&gt;
For detailed information on how CBM works and how students can benefit from it, see [[Using certainty-based marking]].&lt;br /&gt;
{|&lt;br /&gt;
| [[File:cbm03.png|thumb|correct answer; very sure]]&lt;br /&gt;
| [[File:cbm05.png|thumb|correct answer; fairly sure]]&lt;br /&gt;
| [[File:cmb04.png|thumb|correct answer; not very sure]]&lt;br /&gt;
| [[File:cbm01.png|thumb|wrong answer; very sure]]&lt;br /&gt;
| [[File:cbm99.png|thumb|wrong answer; not very sure]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Managing question behaviours==&lt;br /&gt;
&lt;br /&gt;
An administrator can manage question behaviours available across the site in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Question behaviours &amp;gt; Manage question behaviours&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
==Deferred feedback with explanation==&lt;br /&gt;
[https://moodle.org/plugins/view.php?plugin=qbehaviour_deferredfeedbackexplain Deferred feedback with explanation] is an additional question behaviour, available for Moodle 2.6+,  that is just like deferred feedback, but with an additional input box where students can give a reason why they gave the answer they did. No attempt is made to automatically grade the explanation, nor is it required. &lt;br /&gt;
* It may be used in various ways, for example:&lt;br /&gt;
** The teacher may want to manually edit the grades where the student gave a wrong answer, to give partial credit if the student used the right method or approach.&lt;br /&gt;
** The student might want to explain their thinking, so that later, when the results and feedback are revealed, they are reminded of what they were thinking at the time, and so can reflect more deeply.&lt;br /&gt;
* You can use [[Language customization]] to change the default text string &amp;quot;Explain your reasons&amp;quot;  in the file qbehaviour_deferredfeedbackexplain.php to a more specific text such as &amp;quot;Enter justifications below if you want partial credit in numerical problems by showing your steps, ignore otherwise.&amp;quot; as described in https://moodle.org/mod/forum/discuss.php?d=275752&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://www.ucl.ac.uk/lapt/ LAPT: UCL home of Certainty-Based Marking]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=225920 CBM too harsh?] forum discussion&lt;br /&gt;
* [http://school.demo.moodle.net/mod/quiz/view.php?id=1496  School demo example of a quiz with CBM]  Log into with username &amp;quot;parent&amp;quot; and password &amp;quot;moodle&amp;quot;&lt;br /&gt;
* [http://helderenwijzer.nl/2011/10/certainty-based-marking-in-moodle/ Certainty Based Marking in Moodle] blog post by Isabelle Langeveld&lt;br /&gt;
* [http://www.open.edu/openlearnworks/mod/oucontent/view.php?id=51788&amp;amp;section=6 Styles of interactive computer marked assessments] from the Open University &lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=313947 This forum thread] about adding an &#039;all or nothing&#039;  behaviour for adaptive and deferred feedback for questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
&lt;br /&gt;
[[de:Frageverhalten]]&lt;br /&gt;
[[es:Comportamientos de preguntas]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131974</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131974"/>
		<updated>2018-09-25T09:26:25Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Exporter un glossaire vers un Test]]&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131973</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131973"/>
		<updated>2018-09-24T21:45:12Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[fr:Exporter un glossaire vers un Test]]&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131969</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131969"/>
		<updated>2018-09-21T17:22:18Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
== Exporting the selected entries as questions to a moodle Questions XML file ==&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the &#039;&#039;&#039;Export n entries and create n questions&#039;&#039;&#039; link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; [glosssary name] -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export button.&lt;br /&gt;
# At the prompt, save file to your computer. Its named after this pattern: &#039;&#039;&#039;[glosssary name] [QUESTIONTYPE (abbreviated)] questions.xml&#039;&#039;&#039;.&lt;br /&gt;
# Click the Return to course button/link. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported &lt;br /&gt;
# You can now use these questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131968</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131968"/>
		<updated>2018-09-21T17:13:50Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Configuring an Export Glossary to Quiz block */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 2 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of total choices/answers you want to make available to the student (this number includes the correct answer plus the distracters).&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Number the choices&#039;&#039; Select your preferred numbering style for the choices..&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Matching&#039;&#039;&#039;&#039;&#039; questions will consist of a number of concepts and definitions which the student will have to match. A standard text of instructions will be added to the question: &#039;Match the definitions and the concepts&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of pairs you want to make available for matching.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039;&#039; questions will consist of a number of definitions which the student will have to complete by dragging &amp;amp; dropping the concepts into blanks. A standard text of instructions will be added to the question: &#039;Drag each concept label to match its definition&#039;. When you select this type, 2 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. Select the number of articles you want to make available for each question.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;Shuffle within questions&#039;  Select whether the answers will be shuffled.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Save changes&#039;&#039;&#039; Upon saving the form validation check may throw out a message warning you that the number of entries or of choices you entered are incorrect. Please amend as needed before re-saving!&lt;br /&gt;
&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the [Export n entries] link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; (e.g.) Demo -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export entries to file button.&lt;br /&gt;
# At the prompt, save file to your computer. Its name is e.g. Demo_Glossary.xml.&lt;br /&gt;
# Go back to the course&#039;s homepage. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer in step A 10 (Demo_Glossary.xml. and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported (of the SHORTANSWER type).&lt;br /&gt;
# You can use the SHORTANSWER or the MULTICHOICE questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
You can use the SHORTANSWER questions to create one or more Random Short-Answer MATCHING questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131967</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131967"/>
		<updated>2018-09-21T15:03:52Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: Doc for the new version of this block (from Moodle 3.5) ... work in progress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz/issues&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to &#039;&#039;&#039;Short answer&#039;&#039;&#039;, &#039;&#039;&#039;Multiple choice&#039;&#039;&#039;, &#039;&#039;&#039;Matching&#039;&#039;&#039; or &#039;&#039;&#039;Drag and drop into text&#039;&#039;&#039; questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
=== How to access the block&#039;s configuration ===&lt;br /&gt;
After this block has been installed (by an Admin) on your Moodle site, it should be available to the site&#039;s users with a Teacher capability, in their own courses.&lt;br /&gt;
# As a teacher, go to your course&#039;s front page, Click on the main Actions icon to go into Edit mode and Turn editing on.&lt;br /&gt;
# In the side panel, click on Add a block. In the list which appears, click to select the Export Glossary to Quiz block.&lt;br /&gt;
# The Export Glossary to Quiz block gets displayed in your course&#039;s default block zone (depending on the current theme).&lt;br /&gt;
# Click on the block&#039;s Action icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
=== Configuring an Export Glossary to Quiz block ===&lt;br /&gt;
# Use the drop-down list to &#039;&#039;&#039;select the glossary&#039;&#039;&#039; that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select one category to export its entries. To cancel your choice or to reset the block, simply leave that drop-down list on the Choose... position. Once a glossary has been selected, more options appear...&lt;br /&gt;
# &#039;&#039;&#039;Sorting Order&#039;&#039;&#039;. Use this setting to determine how the exported glossary entries will be ordered when you import them to your questions data bank. This can be used, in combination with the Maximum number of entries, for creating a quiz to test the latest entries to your glossary (especially a fairly large one).&lt;br /&gt;
# &#039;&#039;&#039;Maximum number of entries to export&#039;&#039;&#039;. Leave this field empty (or at its default &#039;&#039;&#039;0&#039;&#039;&#039; value) to export &#039;&#039;&#039;all&#039;&#039;&#039; entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# &#039;&#039;&#039;Select question type&#039;&#039;&#039;&lt;br /&gt;
##&#039;&#039;&#039;&#039;&#039;Short answer&#039;&#039;&#039;&#039;&#039; When you select this type, a Case sensitivity drop-down list is displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Case insensitive&#039;&#039;. Student responses will be accepted as correct regardless of the original glossary entry concept case (upper-case or lower-case). Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used. Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
## &#039;&#039;&#039;&#039;&#039;Multiple choice&#039;&#039;&#039;&#039;&#039; questions will consist of the following elements: &#039;&#039;question text&#039;&#039; = glossary entry definition; &#039;&#039;correct answer&#039;&#039; = glossary entry concept; &#039;&#039;distracters&#039;&#039; = 3 (or more) glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected. When you select this type, 3 drop-down lists get displayed. &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;Number of choices&#039;&#039;. &amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Number the choices?&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
### You have a choice of 4 types of numbering for the exported multiple choice questions:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; a. b. c. (the default numbering type)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;A. B. C. D.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;1. 2. 3.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;no numbering&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# When done, click OK.&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the [Export n entries] link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; (e.g.) Demo -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export entries to file button.&lt;br /&gt;
# At the prompt, save file to your computer. Its name is e.g. Demo_Glossary.xml.&lt;br /&gt;
# Go back to the course&#039;s homepage. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer in step A 10 (Demo_Glossary.xml. and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported (of the SHORTANSWER type).&lt;br /&gt;
# You can use the SHORTANSWER or the MULTICHOICE questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
You can use the SHORTANSWER questions to create one or more Random Short-Answer MATCHING questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131966</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=131966"/>
		<updated>2018-09-20T21:50:00Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = https://github.com/rezeau/moodle-block_glossary_export_to_quiz&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to SHORTANSWER or MULTICHOICE questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
&lt;br /&gt;
# Go to your course&#039;s front page and go into Edit mode and click on the Configuration icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
# Use the dropdown list to select the glossary that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select only one category to export its entries. To cancel your choice or to reset the block, simply leave the dropdown list on the Choose... position.&lt;br /&gt;
# Maximum number of entries to export. Leave empty to export all entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# Glossary entries can be exported to the Quiz Questions bank either as multiple choice or short answer questions.&lt;br /&gt;
## Multiple choice questions will consist of the following elements:&lt;br /&gt;
### question text = glossary entry definition&lt;br /&gt;
### correct answer = glossary entry concept&lt;br /&gt;
### distracters = 3 glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected.&lt;br /&gt;
### You have a choice of 4 types of numbering for the exported multiple choice questions:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; a. b. c. (the default numbering type)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;A. B. C. D.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;1. 2. 3.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;no numbering&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
##Short answer questions&lt;br /&gt;
### Case insensitive. Student responses will be accepted as correct regardless of the original glossary entry concept case (uppercase or lowercase).&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
### Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used.&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
# When done, click OK.&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the [Export n entries] link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; (e.g.) Demo -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export entries to file button.&lt;br /&gt;
# At the prompt, save file to your computer. Its name is e.g. Demo_Glossary.xml.&lt;br /&gt;
# Go back to the course&#039;s homepage. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer in step A 10 (Demo_Glossary.xml. and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported (of the SHORTANSWER type).&lt;br /&gt;
# You can use the SHORTANSWER or the MULTICHOICE questions in a quiz.&lt;br /&gt;
&lt;br /&gt;
You can use the SHORTANSWER questions to create one or more Random Short-Answer MATCHING questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Exportación de glosario a examen]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=URL_resource_settings&amp;diff=115227</id>
		<title>URL resource settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=URL_resource_settings&amp;diff=115227"/>
		<updated>2014-10-13T14:25:03Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Display */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{URL}}&lt;br /&gt;
==Adding a URL resource to your course==&lt;br /&gt;
&lt;br /&gt;
# Turn editing on.&lt;br /&gt;
#From the the &amp;quot;Add an activity or resource&amp;quot; link (or, if not present, the &amp;quot;Add a resource&amp;quot; drop down menu),choose URL. All settings may expanded by clicking the &amp;quot;Expand all/Collapse all&amp;quot; link top right.&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
[[File:urlgeneral25.png]]&lt;br /&gt;
&lt;br /&gt;
===Name===&lt;br /&gt;
Whatever you type here will form the link learners click on to view the URL so it is helpful to give it a name that suggests its purpose.&lt;br /&gt;
===Description===&lt;br /&gt;
Add a description of your page here. Click &amp;quot;Show editing tools&amp;quot; to display the rich text editor, and drag the bottom right of the text box out to expand it.&lt;br /&gt;
===Display description on the course page===&lt;br /&gt;
If this box is ticked, the description will appear on the course page just below the name of the URL.&lt;br /&gt;
&lt;br /&gt;
==Content==&lt;br /&gt;
&lt;br /&gt;
[[File:Url.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Either enter the URL in the external URL field or click the &amp;quot;Choose a link&amp;quot; button to open the file picker and choose a URL YouTube, Picasa etc (depending on which [[Repositories|repositories]] are enabled for the site. &lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
&lt;br /&gt;
[[File:urlappearance.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Display===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Automatic&#039;&#039; - Make the best guess at what should happen (probably what is wanted 99% of the time).&lt;br /&gt;
* &#039;&#039;Embed&#039;&#039; - Show the Moodle page with heading, blocks and footer. Show the title/description of the item and display the file directly in the page as well&lt;br /&gt;
* &#039;&#039;Open&#039;&#039; - No Moodle heading, blocks, footer or description - just show the file in the web browser (e.g. shows image, PDF, flash animation, taking up the whole browser window)&lt;br /&gt;
* &#039;&#039;In pop-up&#039;&#039; - Same as &#039;Open&#039;, but opens a new browser window to show this file (without the Moodle heading, blocks, etc) - this browser window also does not have all the menus in it.&lt;br /&gt;
&lt;br /&gt;
The above options are the default display options. Additional display options (see below) may be enabled by an administrator in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; URL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pop-up width/height===&lt;br /&gt;
If your URL is to be displayed in a pop-up, specify the width and height here.&lt;br /&gt;
&lt;br /&gt;
===Display URL name/description===&lt;br /&gt;
To show the resource name and/or description when clicking to access the URL, simply tick the appropriate checkboxes.&lt;br /&gt;
&lt;br /&gt;
==URL variables==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
&lt;br /&gt;
[[File:url.png]]&lt;br /&gt;
&lt;br /&gt;
This section allows you to pass internal information as part of the URL.&lt;br /&gt;
&lt;br /&gt;
This is useful if the URL is actually an interactive web page that takes parameters, and you want to pass something like the name of the current user, for example.&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
See [[Common module settings]] &lt;br /&gt;
==Restrict access/Activity completion==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
&lt;br /&gt;
These settings are visible if [[Conditional activities]] and [[Activity completion]] have been enabled in the site and the course.&lt;br /&gt;
&lt;br /&gt;
==Drag and Drop a URL==&lt;br /&gt;
Alternatively, if an administrator has enabled the experimental feature drag and drop upload of text/links in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Experimental &amp;gt; [[Experimental settings]]&#039;&#039;, a link can be dragged into a section of the course and given a name, as shown in the images below.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[File:dragURL.png|thumb|Adding a URL using drag and drop]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==URL module capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/mod/url:view|View URL resource]]&lt;br /&gt;
* [[Capabilities/mod/url:addinstance|Add a new URL resource]]&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
&lt;br /&gt;
The URL module has additional settings which may be changed by an administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; URL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Frame height===&lt;br /&gt;
&lt;br /&gt;
Here you can specify the height of the top frame (containing the navigation) if you choose the  &amp;quot;in frame&amp;quot; display option.  Note:If your theme has a large header then the height should be increased to prevent horizontal and vertical scrollbars.&lt;br /&gt;
&lt;br /&gt;
===Require activity description===&lt;br /&gt;
&lt;br /&gt;
This setting allows you to turn off the requirement for users to type something into the description box.&lt;br /&gt;
&lt;br /&gt;
===Password===&lt;br /&gt;
&lt;br /&gt;
Here you can add a password that will connect your users to a secure site. [http://moodle.org/mod/forum/discuss.php?d=189842#p826416 See this forum post] for more details.&lt;br /&gt;
&lt;br /&gt;
===Include role names in parameters===&lt;br /&gt;
&lt;br /&gt;
===Available display options===&lt;br /&gt;
&lt;br /&gt;
This setting allows you to add different ways the resource may be displayed on the course page. There are a number of defaults but you can add or change them here. Other display options are:&lt;br /&gt;
* &#039;&#039;In frame&#039;&#039; - show the Moodle heading and the file description, with the file displayed in a resizeable area below &lt;br /&gt;
* &#039;&#039;New window&#039;&#039; - very much like &#039;in pop-up&#039;, but the new window is a full browser window, with menus and address bar, etc.&lt;br /&gt;
[[File:Display.gif]]&lt;br /&gt;
&lt;br /&gt;
===Default values for activity settings===&lt;br /&gt;
&lt;br /&gt;
Here you can set the defaults for this resource. &lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://youtu.be/X32dao-UENQ The Moodle URL Resource] MoodleBites video on YouTube&lt;br /&gt;
&lt;br /&gt;
[[de:Link/URL konfigurieren]]&lt;br /&gt;
[[fr:Paramètres de l&#039;URL]]&lt;br /&gt;
[[es:Configuraciones del recurso URL]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115196</id>
		<title>Lesson settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115196"/>
		<updated>2014-10-08T14:10:20Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Progress bar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Lesson}}&lt;br /&gt;
=Lesson administration settings=&lt;br /&gt;
&lt;br /&gt;
This page explains the settings involved when first creating a lesson.&lt;br /&gt;
To add a lesson to your Moodle course page:&lt;br /&gt;
*With the editing turned on, in the section you wish to add your lesson, click the &amp;quot;Add an activity or resource&amp;quot; link (or, if not present, the &amp;quot;Add an activity&amp;quot; drop down menu) and choose &#039;&#039;Lesson&#039;&#039; All settings may expanded by clicking the &amp;quot;Expand all&amp;quot; link top right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
{|&lt;br /&gt;
|[[File:addlessontitle.png|thumb|274px|General settings expanded by default]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Name===&lt;br /&gt;
Whatever you type here will form the link learners click on to view the lesson so it is helpful to give it a name that suggests its purpose. &lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonappearance.png|thumb|404px|Appearance settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===File pop===&lt;br /&gt;
If you want to include a link to a file on the lesson page for students to refer to, upload it here.&lt;br /&gt;
===Progress bar===&lt;br /&gt;
Choose this to show a bar at the bottom of the page showing how far into the lesson the student has got.&lt;br /&gt;
* For lessons containing &#039;&#039;&#039;only&#039;&#039;&#039; &#039;&#039;Content pages&#039;&#039;, once a lesson has been taken to the end, if that same lesson is re-taken, the progress bar will not be &amp;quot;reset&amp;quot;, i.e. it will show a 100% progress from page 1! &lt;br /&gt;
&lt;br /&gt;
* For lessons containing &#039;&#039;Question pages&#039;&#039; and set to &amp;quot;Re-take&amp;quot; &#039;&#039;&#039;Yes&#039;&#039;&#039;, the progress bar is always &amp;quot;reset&amp;quot; at 0% upon re-take.&lt;br /&gt;
&lt;br /&gt;
* Note that the Lesson Progress bar only works correctly for lessons with a &amp;quot;straightforward&amp;quot; navigation, such as page 1 -&amp;gt; page  2 -&amp;gt; page n -&amp;gt; end of lesson. It is not guaranteed to work with pages &amp;quot;jumping all over the place&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Display ongoing score===&lt;br /&gt;
Choose this to let students see their score as they work through the lesson.&lt;br /&gt;
===Display left menu=== &lt;br /&gt;
Choose this if you want to show a list of the pages in the Lesson so a student can see what is coming up.&lt;br /&gt;
===Minimum grade to display menu===&lt;br /&gt;
Choose this if you want the student to go through the lesson once and get a grade before they can (on review) see and navigate through all the different pages.&lt;br /&gt;
===Slideshow===&lt;br /&gt;
Please note that slideshow mode currently does not work for Moodle 2. There is a tracker issue and patch here MDL-36673&lt;br /&gt;
===Maximum Number of Answers===&lt;br /&gt;
Here you can set the default number of answer boxes available when you add your question or content pages. For instance, if you are only going to use True/False, you would only need 2. You can change this at any time so it&#039;s not crucial.&lt;br /&gt;
===Use default feedback===&lt;br /&gt;
Choose this if you want to show a set phrase regardless of their answer. If you have set your own default feedback such as &amp;quot;well done; correct&amp;quot; or &amp;quot;never mind; better luck next time&amp;quot; etc it will appear. If you have not, then Moodle&#039;s default feedback will appear.&lt;br /&gt;
&lt;br /&gt;
===Link to next activity===&lt;br /&gt;
Choose this to give students a link to another activity when they reach the end of the lesson. &#039;&#039;(Note: this can also be achieved using [[Conditional activities]])&#039;&#039;&lt;br /&gt;
==Availability==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonavailability.png|thumb|470px|Availability settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===Available from/Deadline===&lt;br /&gt;
Here you can set a start and end date and time for your Lesson.&lt;br /&gt;
===Time limit=== &lt;br /&gt;
[[Image:Lesson Timer.png|right]]&lt;br /&gt;
This allows you to set a time limit on the lesson. Students will see a countdown counter as they work. The timer does not stop them doing the lesson when the time is up, but  correct answers are no longer scored.&lt;br /&gt;
&lt;br /&gt;
===Password protected lesson===&lt;br /&gt;
*Change to &amp;quot;Yes&amp;quot;  and enter the password if you want students only to access it when they know the password.&lt;br /&gt;
&lt;br /&gt;
==Prerequisite lesson==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:prereqlesson.png|thumb|460px|Prerequisite lesson settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Dependent on===&lt;br /&gt;
This allows access to the lesson to be dependent on students&#039; performance in another lesson in the same course. &#039;&#039;(Note: this can also be achieved with [[Conditional activities]])&#039;&#039;&lt;br /&gt;
===Time spent===&lt;br /&gt;
Decide here how long you want the student to have spent in the chosen previous lesson&lt;br /&gt;
===Completed===&lt;br /&gt;
Check this box if you want the student to have completed a previous lesson (according to [[Activity completion]] settings)&lt;br /&gt;
===Grade better than===&lt;br /&gt;
Enter the grade  from the previous lesson which you want the student to have exceeded before they can attempt the current lesson.&lt;br /&gt;
&lt;br /&gt;
==Flow control==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:flowcontrol.png|thumb|450px|Flow control settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Allow Student Review===&lt;br /&gt;
This puts a &amp;quot;Review Lesson&amp;quot; button on the last screen of the lesson to encourage the students to navigate through the lesson again from the start.&lt;br /&gt;
:Note that the students will not be able to &#039;&#039;change&#039;&#039; their answers, only &#039;&#039;view&#039;&#039; them.&lt;br /&gt;
&lt;br /&gt;
===Provide option to try a question again===&lt;br /&gt;
*This displays a button after an incorrectly answered question so that the student can try again (but not get credit for it)&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Leave this off if you are using essay questions. &lt;br /&gt;
===Maximum Number of Attempts===&lt;br /&gt;
*Decide here how many times you want students to be able to attempt each question. When they reach the maximum, they will be taken automatically to the next page.&lt;br /&gt;
===Action after a Correct Answer===&lt;br /&gt;
Choose here where you want a student to be sent to if they get a question right. See [[Using Lesson]] for more details on this setting. The options are:&lt;br /&gt;
**the next part of the Lesson (default setting)&lt;br /&gt;
**a random, unexpected page&lt;br /&gt;
**a random page which they have not yet answered.&lt;br /&gt;
===Number of pages to show===&lt;br /&gt;
You only need this if you have set &amp;quot;Action after a correct answer&amp;quot; to show an unseen or unanswered page. Otherwise, all pages will be seen&lt;br /&gt;
&lt;br /&gt;
==Grade==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessongrade.png|thumb|450px|Grade settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Set a grade and grade category here.&lt;br /&gt;
&lt;br /&gt;
===Practice lesson===&lt;br /&gt;
Use this if you don&#039;t need the lesson to be scored/graded but just need students to work through some pages. Set this to Yes to have the same ungraded type Lesson in earlier versions of Moodle.&lt;br /&gt;
&lt;br /&gt;
===Custom Scoring===&lt;br /&gt;
Use this to give a particular number score (negative or positive) to each answer&lt;br /&gt;
===Re-takes allowed===&lt;br /&gt;
Choose this if you want your students to be able to do the lesson more than once.&lt;br /&gt;
:Note that this setting only applies to lessons containing &#039;&#039;Question pages&#039;&#039;. Lessons consisting &#039;&#039;&#039;only&#039;&#039;&#039; of &#039;&#039;Content pages&#039;&#039; can be re-taken even if &#039;Re-takes allowed&#039; is set to &#039;&#039;No&#039;&#039;.&lt;br /&gt;
====Handling of re-take====&lt;br /&gt;
If you allow your students to re-take the lesson, then decide here if the grade for all lesson attempts is the mean or the maximum.&lt;br /&gt;
&lt;br /&gt;
:Note that the Question Analysis always uses the answers from the first tries of the lesson. Re-takes by students are ignored.&lt;br /&gt;
&lt;br /&gt;
===Minimum Number of Questions===&lt;br /&gt;
Set here the minimum number of questions that will be used to calculate a student&#039;s score. Students will  be told how many they have answered and how many more they need to answer.&lt;br /&gt;
*If you are using Content pages, then set this to 0.&lt;br /&gt;
*If you use this setting, then add some explanatory text at the start of the lesson so the student knows how many questions they must answer as a minimum. (They may answer more.&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
&lt;br /&gt;
See [[Common module settings]]&lt;br /&gt;
==Restrict access/Activity completion==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
&lt;br /&gt;
The Restrict access and Activity completion settings are visible if [[Conditional activities]] and [[Activity completion]] have been enabled in the site and the course.&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
&lt;br /&gt;
The lesson module has additional settings which may be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Lesson&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; &#039;&#039;The slideshow settings below do not work. See MDL-36673&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Slideshow width===&lt;br /&gt;
Sets the width of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowwidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Slideshow height===&lt;br /&gt;
Sets the height of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Slideshow background colour===&lt;br /&gt;
Background colour to for the slideshow if it is enabled. &lt;br /&gt;
*Variable name: lesson_slideshowbgcolor, Default #FFFFFF.&lt;br /&gt;
&lt;br /&gt;
===Popup window width===&lt;br /&gt;
Sets the width of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediawidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Popup window  height===&lt;br /&gt;
Sets the height of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Show close button:===&lt;br /&gt;
Displays a close button as part of the popup generated for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaclose, Default No.&lt;br /&gt;
&lt;br /&gt;
===Number of high scores displayed===&lt;br /&gt;
Sets the number of high scores to display&lt;br /&gt;
*Variable name: lesson_maxhighscores, Default: 10&lt;br /&gt;
&lt;br /&gt;
===Maximum number of answers===&lt;br /&gt;
Default maximum number of answers per page for site&lt;br /&gt;
*Variable name: lesson_maxanswers, Default: 4.&lt;br /&gt;
&lt;br /&gt;
===Action after correct answer===&lt;br /&gt;
The default action to take after a correct answer&lt;br /&gt;
*Variable name: lesson_defaultnextpage, Default: Normal - follow lesson path&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://youtu.be/cUDV0WE5ZYY Moodle 2.x Lesson (part 1)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/Mfj-8w-Ze0A Moodle 2.x Lesson (part 2)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/jXjqHtgC9c0 Moodle 2.x Lesson (part 3)]  MoodleBites video on YouTube &lt;br /&gt;
&lt;br /&gt;
[[de:Lektion konfigurieren]]&lt;br /&gt;
[[fr:Ajouter/modifier une leçon]]&lt;br /&gt;
[[ja:レッスンの設定]]&lt;br /&gt;
[[es:Configuraciones de lección]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115195</id>
		<title>Lesson settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115195"/>
		<updated>2014-10-08T13:39:21Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Allow Student Review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Lesson}}&lt;br /&gt;
=Lesson administration settings=&lt;br /&gt;
&lt;br /&gt;
This page explains the settings involved when first creating a lesson.&lt;br /&gt;
To add a lesson to your Moodle course page:&lt;br /&gt;
*With the editing turned on, in the section you wish to add your lesson, click the &amp;quot;Add an activity or resource&amp;quot; link (or, if not present, the &amp;quot;Add an activity&amp;quot; drop down menu) and choose &#039;&#039;Lesson&#039;&#039; All settings may expanded by clicking the &amp;quot;Expand all&amp;quot; link top right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
{|&lt;br /&gt;
|[[File:addlessontitle.png|thumb|274px|General settings expanded by default]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Name===&lt;br /&gt;
Whatever you type here will form the link learners click on to view the lesson so it is helpful to give it a name that suggests its purpose. &lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonappearance.png|thumb|404px|Appearance settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===File pop===&lt;br /&gt;
If you want to include a link to a file on the lesson page for students to refer to, upload it here.&lt;br /&gt;
===Progress bar===&lt;br /&gt;
Choose this to show a bar at the bottom of the page showing how far into the lesson the student has got.&lt;br /&gt;
===Display ongoing score===&lt;br /&gt;
Choose this to let students see their score as they work through the lesson.&lt;br /&gt;
===Display left menu=== &lt;br /&gt;
Choose this if you want to show a list of the pages in the Lesson so a student can see what is coming up.&lt;br /&gt;
===Minimum grade to display menu===&lt;br /&gt;
Choose this if you want the student to go through the lesson once and get a grade before they can (on review) see and navigate through all the different pages.&lt;br /&gt;
===Slideshow===&lt;br /&gt;
Please note that slideshow mode currently does not work for Moodle 2. There is a tracker issue and patch here MDL-36673&lt;br /&gt;
===Maximum Number of Answers===&lt;br /&gt;
Here you can set the default number of answer boxes available when you add your question or content pages. For instance, if you are only going to use True/False, you would only need 2. You can change this at any time so it&#039;s not crucial.&lt;br /&gt;
===Use default feedback===&lt;br /&gt;
Choose this if you want to show a set phrase regardless of their answer. If you have set your own default feedback such as &amp;quot;well done; correct&amp;quot; or &amp;quot;never mind; better luck next time&amp;quot; etc it will appear. If you have not, then Moodle&#039;s default feedback will appear.&lt;br /&gt;
&lt;br /&gt;
===Link to next activity===&lt;br /&gt;
Choose this to give students a link to another activity when they reach the end of the lesson. &#039;&#039;(Note: this can also be achieved using [[Conditional activities]])&#039;&#039;&lt;br /&gt;
==Availability==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonavailability.png|thumb|470px|Availability settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===Available from/Deadline===&lt;br /&gt;
Here you can set a start and end date and time for your Lesson.&lt;br /&gt;
===Time limit=== &lt;br /&gt;
[[Image:Lesson Timer.png|right]]&lt;br /&gt;
This allows you to set a time limit on the lesson. Students will see a countdown counter as they work. The timer does not stop them doing the lesson when the time is up, but  correct answers are no longer scored.&lt;br /&gt;
&lt;br /&gt;
===Password protected lesson===&lt;br /&gt;
*Change to &amp;quot;Yes&amp;quot;  and enter the password if you want students only to access it when they know the password.&lt;br /&gt;
&lt;br /&gt;
==Prerequisite lesson==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:prereqlesson.png|thumb|460px|Prerequisite lesson settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Dependent on===&lt;br /&gt;
This allows access to the lesson to be dependent on students&#039; performance in another lesson in the same course. &#039;&#039;(Note: this can also be achieved with [[Conditional activities]])&#039;&#039;&lt;br /&gt;
===Time spent===&lt;br /&gt;
Decide here how long you want the student to have spent in the chosen previous lesson&lt;br /&gt;
===Completed===&lt;br /&gt;
Check this box if you want the student to have completed a previous lesson (according to [[Activity completion]] settings)&lt;br /&gt;
===Grade better than===&lt;br /&gt;
Enter the grade  from the previous lesson which you want the student to have exceeded before they can attempt the current lesson.&lt;br /&gt;
&lt;br /&gt;
==Flow control==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:flowcontrol.png|thumb|450px|Flow control settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Allow Student Review===&lt;br /&gt;
This puts a &amp;quot;Review Lesson&amp;quot; button on the last screen of the lesson to encourage the students to navigate through the lesson again from the start.&lt;br /&gt;
:Note that the students will not be able to &#039;&#039;change&#039;&#039; their answers, only &#039;&#039;view&#039;&#039; them.&lt;br /&gt;
&lt;br /&gt;
===Provide option to try a question again===&lt;br /&gt;
*This displays a button after an incorrectly answered question so that the student can try again (but not get credit for it)&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Leave this off if you are using essay questions. &lt;br /&gt;
===Maximum Number of Attempts===&lt;br /&gt;
*Decide here how many times you want students to be able to attempt each question. When they reach the maximum, they will be taken automatically to the next page.&lt;br /&gt;
===Action after a Correct Answer===&lt;br /&gt;
Choose here where you want a student to be sent to if they get a question right. See [[Using Lesson]] for more details on this setting. The options are:&lt;br /&gt;
**the next part of the Lesson (default setting)&lt;br /&gt;
**a random, unexpected page&lt;br /&gt;
**a random page which they have not yet answered.&lt;br /&gt;
===Number of pages to show===&lt;br /&gt;
You only need this if you have set &amp;quot;Action after a correct answer&amp;quot; to show an unseen or unanswered page. Otherwise, all pages will be seen&lt;br /&gt;
&lt;br /&gt;
==Grade==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessongrade.png|thumb|450px|Grade settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Set a grade and grade category here.&lt;br /&gt;
&lt;br /&gt;
===Practice lesson===&lt;br /&gt;
Use this if you don&#039;t need the lesson to be scored/graded but just need students to work through some pages. Set this to Yes to have the same ungraded type Lesson in earlier versions of Moodle.&lt;br /&gt;
&lt;br /&gt;
===Custom Scoring===&lt;br /&gt;
Use this to give a particular number score (negative or positive) to each answer&lt;br /&gt;
===Re-takes allowed===&lt;br /&gt;
Choose this if you want your students to be able to do the lesson more than once.&lt;br /&gt;
:Note that this setting only applies to lessons containing &#039;&#039;Question pages&#039;&#039;. Lessons consisting &#039;&#039;&#039;only&#039;&#039;&#039; of &#039;&#039;Content pages&#039;&#039; can be re-taken even if &#039;Re-takes allowed&#039; is set to &#039;&#039;No&#039;&#039;.&lt;br /&gt;
====Handling of re-take====&lt;br /&gt;
If you allow your students to re-take the lesson, then decide here if the grade for all lesson attempts is the mean or the maximum.&lt;br /&gt;
&lt;br /&gt;
:Note that the Question Analysis always uses the answers from the first tries of the lesson. Re-takes by students are ignored.&lt;br /&gt;
&lt;br /&gt;
===Minimum Number of Questions===&lt;br /&gt;
Set here the minimum number of questions that will be used to calculate a student&#039;s score. Students will  be told how many they have answered and how many more they need to answer.&lt;br /&gt;
*If you are using Content pages, then set this to 0.&lt;br /&gt;
*If you use this setting, then add some explanatory text at the start of the lesson so the student knows how many questions they must answer as a minimum. (They may answer more.&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
&lt;br /&gt;
See [[Common module settings]]&lt;br /&gt;
==Restrict access/Activity completion==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
&lt;br /&gt;
The Restrict access and Activity completion settings are visible if [[Conditional activities]] and [[Activity completion]] have been enabled in the site and the course.&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
&lt;br /&gt;
The lesson module has additional settings which may be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Lesson&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; &#039;&#039;The slideshow settings below do not work. See MDL-36673&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Slideshow width===&lt;br /&gt;
Sets the width of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowwidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Slideshow height===&lt;br /&gt;
Sets the height of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Slideshow background colour===&lt;br /&gt;
Background colour to for the slideshow if it is enabled. &lt;br /&gt;
*Variable name: lesson_slideshowbgcolor, Default #FFFFFF.&lt;br /&gt;
&lt;br /&gt;
===Popup window width===&lt;br /&gt;
Sets the width of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediawidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Popup window  height===&lt;br /&gt;
Sets the height of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Show close button:===&lt;br /&gt;
Displays a close button as part of the popup generated for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaclose, Default No.&lt;br /&gt;
&lt;br /&gt;
===Number of high scores displayed===&lt;br /&gt;
Sets the number of high scores to display&lt;br /&gt;
*Variable name: lesson_maxhighscores, Default: 10&lt;br /&gt;
&lt;br /&gt;
===Maximum number of answers===&lt;br /&gt;
Default maximum number of answers per page for site&lt;br /&gt;
*Variable name: lesson_maxanswers, Default: 4.&lt;br /&gt;
&lt;br /&gt;
===Action after correct answer===&lt;br /&gt;
The default action to take after a correct answer&lt;br /&gt;
*Variable name: lesson_defaultnextpage, Default: Normal - follow lesson path&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://youtu.be/cUDV0WE5ZYY Moodle 2.x Lesson (part 1)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/Mfj-8w-Ze0A Moodle 2.x Lesson (part 2)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/jXjqHtgC9c0 Moodle 2.x Lesson (part 3)]  MoodleBites video on YouTube &lt;br /&gt;
&lt;br /&gt;
[[de:Lektion konfigurieren]]&lt;br /&gt;
[[fr:Ajouter/modifier une leçon]]&lt;br /&gt;
[[ja:レッスンの設定]]&lt;br /&gt;
[[es:Configuraciones de lección]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115194</id>
		<title>Lesson settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Lesson_settings&amp;diff=115194"/>
		<updated>2014-10-08T13:20:41Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Re-takes allowed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Lesson}}&lt;br /&gt;
=Lesson administration settings=&lt;br /&gt;
&lt;br /&gt;
This page explains the settings involved when first creating a lesson.&lt;br /&gt;
To add a lesson to your Moodle course page:&lt;br /&gt;
*With the editing turned on, in the section you wish to add your lesson, click the &amp;quot;Add an activity or resource&amp;quot; link (or, if not present, the &amp;quot;Add an activity&amp;quot; drop down menu) and choose &#039;&#039;Lesson&#039;&#039; All settings may expanded by clicking the &amp;quot;Expand all&amp;quot; link top right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
{|&lt;br /&gt;
|[[File:addlessontitle.png|thumb|274px|General settings expanded by default]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Name===&lt;br /&gt;
Whatever you type here will form the link learners click on to view the lesson so it is helpful to give it a name that suggests its purpose. &lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonappearance.png|thumb|404px|Appearance settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===File pop===&lt;br /&gt;
If you want to include a link to a file on the lesson page for students to refer to, upload it here.&lt;br /&gt;
===Progress bar===&lt;br /&gt;
Choose this to show a bar at the bottom of the page showing how far into the lesson the student has got.&lt;br /&gt;
===Display ongoing score===&lt;br /&gt;
Choose this to let students see their score as they work through the lesson.&lt;br /&gt;
===Display left menu=== &lt;br /&gt;
Choose this if you want to show a list of the pages in the Lesson so a student can see what is coming up.&lt;br /&gt;
===Minimum grade to display menu===&lt;br /&gt;
Choose this if you want the student to go through the lesson once and get a grade before they can (on review) see and navigate through all the different pages.&lt;br /&gt;
===Slideshow===&lt;br /&gt;
Please note that slideshow mode currently does not work for Moodle 2. There is a tracker issue and patch here MDL-36673&lt;br /&gt;
===Maximum Number of Answers===&lt;br /&gt;
Here you can set the default number of answer boxes available when you add your question or content pages. For instance, if you are only going to use True/False, you would only need 2. You can change this at any time so it&#039;s not crucial.&lt;br /&gt;
===Use default feedback===&lt;br /&gt;
Choose this if you want to show a set phrase regardless of their answer. If you have set your own default feedback such as &amp;quot;well done; correct&amp;quot; or &amp;quot;never mind; better luck next time&amp;quot; etc it will appear. If you have not, then Moodle&#039;s default feedback will appear.&lt;br /&gt;
&lt;br /&gt;
===Link to next activity===&lt;br /&gt;
Choose this to give students a link to another activity when they reach the end of the lesson. &#039;&#039;(Note: this can also be achieved using [[Conditional activities]])&#039;&#039;&lt;br /&gt;
==Availability==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessonavailability.png|thumb|470px|Availability settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
===Available from/Deadline===&lt;br /&gt;
Here you can set a start and end date and time for your Lesson.&lt;br /&gt;
===Time limit=== &lt;br /&gt;
[[Image:Lesson Timer.png|right]]&lt;br /&gt;
This allows you to set a time limit on the lesson. Students will see a countdown counter as they work. The timer does not stop them doing the lesson when the time is up, but  correct answers are no longer scored.&lt;br /&gt;
&lt;br /&gt;
===Password protected lesson===&lt;br /&gt;
*Change to &amp;quot;Yes&amp;quot;  and enter the password if you want students only to access it when they know the password.&lt;br /&gt;
&lt;br /&gt;
==Prerequisite lesson==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:prereqlesson.png|thumb|460px|Prerequisite lesson settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Dependent on===&lt;br /&gt;
This allows access to the lesson to be dependent on students&#039; performance in another lesson in the same course. &#039;&#039;(Note: this can also be achieved with [[Conditional activities]])&#039;&#039;&lt;br /&gt;
===Time spent===&lt;br /&gt;
Decide here how long you want the student to have spent in the chosen previous lesson&lt;br /&gt;
===Completed===&lt;br /&gt;
Check this box if you want the student to have completed a previous lesson (according to [[Activity completion]] settings)&lt;br /&gt;
===Grade better than===&lt;br /&gt;
Enter the grade  from the previous lesson which you want the student to have exceeded before they can attempt the current lesson.&lt;br /&gt;
&lt;br /&gt;
==Flow control==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:flowcontrol.png|thumb|450px|Flow control settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Allow Student Review===&lt;br /&gt;
This puts a &amp;quot;Review Lesson&amp;quot; button on the last screen of the lesson to encourage the student to navigate through the lesson again from the start.  Be sure to check other settings to allow them to change their answers.&lt;br /&gt;
===Provide option to try a question again===&lt;br /&gt;
*This displays a button after an incorrectly answered question so that the student can try again (but not get credit for it)&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Leave this off if you are using essay questions. &lt;br /&gt;
===Maximum Number of Attempts===&lt;br /&gt;
*Decide here how many times you want students to be able to attempt each question. When they reach the maximum, they will be taken automatically to the next page.&lt;br /&gt;
===Action after a Correct Answer===&lt;br /&gt;
Choose here where you want a student to be sent to if they get a question right. See [[Using Lesson]] for more details on this setting. The options are:&lt;br /&gt;
**the next part of the Lesson (default setting)&lt;br /&gt;
**a random, unexpected page&lt;br /&gt;
**a random page which they have not yet answered.&lt;br /&gt;
===Number of pages to show===&lt;br /&gt;
You only need this if you have set &amp;quot;Action after a correct answer&amp;quot; to show an unseen or unanswered page. Otherwise, all pages will be seen&lt;br /&gt;
&lt;br /&gt;
==Grade==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
{|&lt;br /&gt;
|[[File:lessongrade.png|thumb|450px|Grade settings expanded]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Set a grade and grade category here.&lt;br /&gt;
&lt;br /&gt;
===Practice lesson===&lt;br /&gt;
Use this if you don&#039;t need the lesson to be scored/graded but just need students to work through some pages. Set this to Yes to have the same ungraded type Lesson in earlier versions of Moodle.&lt;br /&gt;
&lt;br /&gt;
===Custom Scoring===&lt;br /&gt;
Use this to give a particular number score (negative or positive) to each answer&lt;br /&gt;
===Re-takes allowed===&lt;br /&gt;
Choose this if you want your students to be able to do the lesson more than once.&lt;br /&gt;
:Note that this setting only applies to lessons containing &#039;&#039;Question pages&#039;&#039;. Lessons consisting &#039;&#039;&#039;only&#039;&#039;&#039; of &#039;&#039;Content pages&#039;&#039; can be re-taken even if &#039;Re-takes allowed&#039; is set to &#039;&#039;No&#039;&#039;.&lt;br /&gt;
====Handling of re-take====&lt;br /&gt;
If you allow your students to re-take the lesson, then decide here if the grade for all lesson attempts is the mean or the maximum.&lt;br /&gt;
&lt;br /&gt;
:Note that the Question Analysis always uses the answers from the first tries of the lesson. Re-takes by students are ignored.&lt;br /&gt;
&lt;br /&gt;
===Minimum Number of Questions===&lt;br /&gt;
Set here the minimum number of questions that will be used to calculate a student&#039;s score. Students will  be told how many they have answered and how many more they need to answer.&lt;br /&gt;
*If you are using Content pages, then set this to 0.&lt;br /&gt;
*If you use this setting, then add some explanatory text at the start of the lesson so the student knows how many questions they must answer as a minimum. (They may answer more.&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
(These settings are collapsed by default.)&lt;br /&gt;
&lt;br /&gt;
See [[Common module settings]]&lt;br /&gt;
==Restrict access/Activity completion==&lt;br /&gt;
(These settings are collapsed by default)&lt;br /&gt;
&lt;br /&gt;
The Restrict access and Activity completion settings are visible if [[Conditional activities]] and [[Activity completion]] have been enabled in the site and the course.&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
&lt;br /&gt;
The lesson module has additional settings which may be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Lesson&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; &#039;&#039;The slideshow settings below do not work. See MDL-36673&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Slideshow width===&lt;br /&gt;
Sets the width of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowwidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Slideshow height===&lt;br /&gt;
Sets the height of the slideshow only when this feature is enabled in a Lesson&#039;s &amp;quot;Change settings&amp;quot;. &lt;br /&gt;
*Variable name: lesson_slideshowheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Slideshow background colour===&lt;br /&gt;
Background colour to for the slideshow if it is enabled. &lt;br /&gt;
*Variable name: lesson_slideshowbgcolor, Default #FFFFFF.&lt;br /&gt;
&lt;br /&gt;
===Popup window width===&lt;br /&gt;
Sets the width of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediawidth, Default 640.&lt;br /&gt;
&lt;br /&gt;
===Popup window  height===&lt;br /&gt;
Sets the height of the popup displayed for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaheight, Default 480.&lt;br /&gt;
&lt;br /&gt;
===Show close button:===&lt;br /&gt;
Displays a close button as part of the popup generated for a linked media file&lt;br /&gt;
*Variable name: lesson_mediaclose, Default No.&lt;br /&gt;
&lt;br /&gt;
===Number of high scores displayed===&lt;br /&gt;
Sets the number of high scores to display&lt;br /&gt;
*Variable name: lesson_maxhighscores, Default: 10&lt;br /&gt;
&lt;br /&gt;
===Maximum number of answers===&lt;br /&gt;
Default maximum number of answers per page for site&lt;br /&gt;
*Variable name: lesson_maxanswers, Default: 4.&lt;br /&gt;
&lt;br /&gt;
===Action after correct answer===&lt;br /&gt;
The default action to take after a correct answer&lt;br /&gt;
*Variable name: lesson_defaultnextpage, Default: Normal - follow lesson path&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://youtu.be/cUDV0WE5ZYY Moodle 2.x Lesson (part 1)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/Mfj-8w-Ze0A Moodle 2.x Lesson (part 2)]  MoodleBites video on YouTube &lt;br /&gt;
*[http://youtu.be/jXjqHtgC9c0 Moodle 2.x Lesson (part 3)]  MoodleBites video on YouTube &lt;br /&gt;
&lt;br /&gt;
[[de:Lektion konfigurieren]]&lt;br /&gt;
[[fr:Ajouter/modifier une leçon]]&lt;br /&gt;
[[ja:レッスンの設定]]&lt;br /&gt;
[[es:Configuraciones de lección]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Questionnaire_module&amp;diff=112625</id>
		<title>Questionnaire module</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Questionnaire_module&amp;diff=112625"/>
		<updated>2014-05-14T21:07:27Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questionnaire}}&lt;br /&gt;
&lt;br /&gt;
The Moodle &#039;&#039;&#039;Questionnaire module&#039;&#039;&#039; is a survey-like type of activity.  It is a contributed module which can be downloaded from the [http://moodle.org/plugins/view.php?plugin=mod_questionnaire Moodle Plugins Directory]. It allows teachers to create a wide range of questions to get student feedback e.g. on a course or activities. The goals of the Questionnaire module are quite different from those of the Moodle &#039;&#039;&#039;Lesson&#039;&#039;&#039; or &#039;&#039;&#039;Quiz&#039;&#039;&#039; modules. With Questionnaire you do not test or assess the student, you &#039;&#039;gather data&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Summary of features==&lt;br /&gt;
Please look at the [[Adding/editing a questionnaire]] and [[Editing Questionnaire questions|Adding Questions]] pages for more information.  &lt;br /&gt;
&lt;br /&gt;
===Types of questions===&lt;br /&gt;
*Check Boxes&lt;br /&gt;
*Date Box&lt;br /&gt;
*Dropdown choices&lt;br /&gt;
*Essay box - HTML editor possible, set width and height of box&lt;br /&gt;
*Numeric - can set length and number of decimal places&lt;br /&gt;
*Radio buttons - have labels you determine for each question&lt;br /&gt;
*Scale - can customize in many ways&lt;br /&gt;
*Text box&lt;br /&gt;
*Yes/no&lt;br /&gt;
You can also place:&lt;br /&gt;
*Page breaks &lt;br /&gt;
*Labels - might be used to give an overview of next set of questions&lt;br /&gt;
&lt;br /&gt;
===Types of reports===&lt;br /&gt;
*Responses can be viewed by everyone or select group&lt;br /&gt;
*Responses can be exported&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* The Questionnaire plugin can be downloaded from the [http://moodle.org/plugins/view.php?plugin=mod_questionnaire Moodle Plugins Directory].&lt;br /&gt;
*Discussions: please create or find a discussion topic in the [http://moodle.org/mod/forum/view.php?f=469  Questionnaire Forum]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Statistical_survey Statistical_survey] From Wikipedia, the free encyclopedia.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Moodle 2.8&#039;&#039;&#039; will hopefully have a new module that combines the best of Questionnaire, Feedback and Survey into an upgrade for the Survey module. See [https://docs.moodle.org/en/Development:Survey_2_brainstorm Development: Survey 2 brainstorm]&lt;br /&gt;
&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[es:Módulo cuestionario]]&lt;br /&gt;
[[fr:Questionnaire]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=112094</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=112094"/>
		<updated>2014-04-23T09:37:23Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = &lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing add-ons]]&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to SHORTANSWER or MULTICHOICE questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
&lt;br /&gt;
# Go to your course&#039;s front page and go into Edit mode and click on the Configuration icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
# Use the dropdown list to select the glossary that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select only one category to export its entries. To cancel your choice or to reset the block, simply leave the dropdown list on the Choose... position.&lt;br /&gt;
# Maximum number of entries to export. Leave empty to export all entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# Glossary entries can be exported to the Quiz Questions bank either as multiple choice or short answer questions.&lt;br /&gt;
## Multiple choice questions will consist of the following elements:&lt;br /&gt;
### question text = glossary entry definition&lt;br /&gt;
### correct answer = glossary entry concept&lt;br /&gt;
### distracters = 3 glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected.&lt;br /&gt;
### You have a choice of 4 types of numbering for the exported multiple choice questions:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; a. b. c. (the default numbering type)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;A. B. C. D.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;1. 2. 3.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;no numbering&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
##Short answer questions&lt;br /&gt;
### Case insensitive. Student responses will be accepted as correct regardless of the original glossary entry concept case (uppercase or lowercase).&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
### Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used.&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
# When done, click OK.&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the [Export n entries] link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; (e.g.) Demo -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export entries to file button.&lt;br /&gt;
# At the prompt, save file to your computer. Its name is e.g. Demo_Glossary.xml.&lt;br /&gt;
# Go back to the course&#039;s homepage. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer in step A 10 (Demo_Glossary.xml. and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported (of the SHORTANSWER type).&lt;br /&gt;
# You can use the SHORTANSWER or the MULTICHOICE questions in a quiz.&lt;br /&gt;
{{New features}}&lt;br /&gt;
You can use the SHORTANSWER questions to create one or more Random Short-Answer MATCHING questions.&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=112093</id>
		<title>Glossary export to quiz</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Glossary_export_to_quiz&amp;diff=112093"/>
		<updated>2014-04-23T09:27:04Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Import to the quiz questions bank */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_glossary_export_to_quiz&lt;br /&gt;
|tracker = &lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=162866&lt;br /&gt;
|maintainer = [[User:Joseph Rézeau|Joseph Rézeau]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
# Download the &#039;&#039;Glossary export to quiz&#039;&#039; installation file and unzip it to the &#039;&#039;&#039;\blocks&#039;&#039;&#039; directory in your Moodle folder.&lt;br /&gt;
# Be sure that the final name of the directory is: glossary_export_to_quiz, the full path in your Moodle installation will be blocks/glossary_export_to_quiz&lt;br /&gt;
# Login to Moodle as Administrator and click Notifications under Site Administration.&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing plugins]]&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
A block to export a Glossary&#039;s entries to the Quiz Questions bank. Exports concepts &amp;amp; definitions to SHORTANSWER or MULTICHOICE questions.&lt;br /&gt;
&lt;br /&gt;
==Export entries from Glossary to moodle quiz XML file==&lt;br /&gt;
&lt;br /&gt;
# Go to your course&#039;s front page and go into Edit mode and click on the Configuration icon to configure the Export Glossary to Quiz block.&lt;br /&gt;
# Use the dropdown list to select the glossary that you want to use to export its entries to the quiz questions bank. If that glossary contains categories, you can select only one category to export its entries. To cancel your choice or to reset the block, simply leave the dropdown list on the Choose... position.&lt;br /&gt;
# Maximum number of entries to export. Leave empty to export all entries from selected Glossary or Category. This option can be useful for exporting a limited number of entries from very large glossaries.&lt;br /&gt;
# Glossary entries can be exported to the Quiz Questions bank either as multiple choice or short answer questions.&lt;br /&gt;
## Multiple choice questions will consist of the following elements:&lt;br /&gt;
### question text = glossary entry definition&lt;br /&gt;
### correct answer = glossary entry concept&lt;br /&gt;
### distracters = 3 glossary entry concepts randomly selected from the glossary (or glossary category) that you have selected.&lt;br /&gt;
### You have a choice of 4 types of numbering for the exported multiple choice questions:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; a. b. c. (the default numbering type)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;A. B. C. D.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;1. 2. 3.&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;no numbering&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
##Short answer questions&lt;br /&gt;
### Case insensitive. Student responses will be accepted as correct regardless of the original glossary entry concept case (uppercase or lowercase).&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct responses: &amp;quot;Moodle&amp;quot;, &amp;quot;moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
### Case sensitive. Student responses will be only be accepted as correct it the case of the original glossary entry concept is used.&amp;lt;p&amp;gt;Example: original entry &amp;quot;Moodle&amp;quot;. Accepted correct response: &amp;quot;Moodle&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
# When done, click OK.&lt;br /&gt;
# You are back in the course homepage, but now the block displays the settings you have selected.&lt;br /&gt;
# Click on the [Export n entries] link.&lt;br /&gt;
# Now you are on page Your course -&amp;gt; Glossaries -&amp;gt; (e.g.) Demo -&amp;gt; Glossary -&amp;gt; Export entries to Quiz (XML)&lt;br /&gt;
# Click on the Export entries to file button.&lt;br /&gt;
# At the prompt, save file to your computer. Its name is e.g. Demo_Glossary.xml.&lt;br /&gt;
# Go back to the course&#039;s homepage. You see that the the Export Glossary to Quiz block has been reset.&lt;br /&gt;
&lt;br /&gt;
==Import to the quiz questions bank==&lt;br /&gt;
# Turn editing on&lt;br /&gt;
# In Administration block, click Questions&lt;br /&gt;
# On the Edit questions page, Click the Import tab&lt;br /&gt;
# Set these settings:&amp;lt;p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;File format : Moodle XML format&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;General&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Category Default&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Get category from file (check it)&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Import from file upload...&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
# Go to the file you saved to your computer in step A 10 (Demo_Glossary.xml. and click Upload this file button.&lt;br /&gt;
# If all goes well, the imported questions should get displayed on the next screen.&lt;br /&gt;
# Click Continue.&lt;br /&gt;
# On the next page, the Question bank displays the new category name (formed on the name of the exported Glossary, plus the name of its category if you selected one of the glossary&#039;s categories) and of course all the questions that were imported (of the SHORTANSWER type).&lt;br /&gt;
# You can use the SHORTANSWER or the MULTICHOICE questions in a quiz.&lt;br /&gt;
{{New features}}&lt;br /&gt;
You can use the SHORTANSWER questions to create one or more Random Short-Answer MATCHING questions.&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=112013</id>
		<title>Regular Expression Short-Answer question type</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/38/en/index.php?title=Regular_Expression_Short-Answer_question_type&amp;diff=112013"/>
		<updated>2014-04-21T12:58:01Z</updated>

		<summary type="html">&lt;p&gt;Rezeau: /* Inserting RegExp sub-questions in Cloze type questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===The RegExp Short Answer Question===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;IMPORTANT NOTE&#039;&#039;&#039;&lt;br /&gt;
** The RegExp Short Answer question described in this documentation page is a 3rd-party plugin, which allows you to create questions for the &#039;&#039;&#039;&#039;&#039;Quiz&#039;&#039;&#039;&#039;&#039; activity. It is &#039;&#039;different&#039;&#039; from the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module.&lt;br /&gt;
** The documentation for the &amp;quot;Use regular expressions&amp;quot; option in the &#039;&#039;&#039;&#039;&#039;Lesson&#039;&#039;&#039;&#039;&#039; module is to be found at: [https://docs.moodle.org/en/Short_answer_analysis Short answer analysis].&lt;br /&gt;
&lt;br /&gt;
Like the Short Answer question, the RegExp Short Answer question expects the respondent to answer an &amp;quot;open&amp;quot; question with a word or a short phrase. However, the RegExp system system gives you access to a more powerful system for &#039;&#039;analyzing the student&#039;s answers&#039;&#039; with the aim of &#039;&#039;providing more relevant immediate feedback&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Correct answer matching a regular expression pattern===&lt;br /&gt;
&lt;br /&gt;
It is not possible to give complete examples of the vast possibilities offered by this system, and the following are just some possibilities.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 1.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Suppose your question was &amp;quot;What are the colors of the French flag?&amp;quot;. In the Answer 1 box you would type the &amp;quot;best&amp;quot; answer, e.g. &amp;quot;it&#039;s blue, white and red&amp;quot;. For more details, see [[#firstcorrect|First correct answer]] below.&lt;br /&gt;
&lt;br /&gt;
*In the Answer 2 box you would type this regular expression: &amp;quot;it&#039;s blue, white(,| and) red&amp;quot; (quotes should not be typed, of course).&lt;br /&gt;
* If [[#casesensivity|Case sensivity]] is set to &amp;quot;No&amp;quot;, this will match any of those 4 responses:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    It&#039;s blue, white, red&lt;br /&gt;
    It&#039;s blue, white and red&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 2&#039;&#039;&#039;.====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are blue, red and yellow?&amp;quot;. &lt;br /&gt;
* Answer 1: &amp;quot;they are colours&amp;quot;. &lt;br /&gt;
* Answer 2: &amp;quot;(|they(&#039;| a)re )colou?rs&amp;quot;. &lt;br /&gt;
* This will match any of those 6 responses:&lt;br /&gt;
    colours&lt;br /&gt;
    colors&lt;br /&gt;
    they&#039;re colours&lt;br /&gt;
    they&#039;re colors&lt;br /&gt;
    they are colours&lt;br /&gt;
    they are colors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- The beginning of this regular expression &amp;quot;(|they(&#039;| a)re )&amp;quot; will match either nothing or &amp;quot;they&#039;re &amp;quot; or &amp;quot;they are &amp;quot;. In &amp;quot;colou?r&amp;quot;, the question-mark means: the preceding character (or parenthesized group of characters) zero or one time; it is used here to match British English as well as US spelling. &lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 3.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;cat&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;[bcr]at&amp;quot;. &lt;br /&gt;
* This will match: bat, cat or rat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- In Regular Expression syntax, the inclusion of characters between square brackets means than ANY of those characters can be used. So, in the above example, the regular expression &amp;quot;[bcr]at&amp;quot; is the exact equivalent of &amp;quot;(b|c|r)at&amp;quot;. Be careful NOT to include the pipe character as separator in your [...] regular expressions. For instance, &amp;quot;[b|c|r]at&amp;quot; will NOT WORK CORRECTLY.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 4.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The &#039;permutation&#039; feature (introduced in regexp version &#039;&#039;&#039;2012102900&#039;&#039;&#039; for Moodle 2.3+)&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;What are the colours of the French flag (in any order)&amp;quot;.&lt;br /&gt;
* Answer 1: &amp;quot;it&#039;s blue, white and red&amp;quot;&lt;br /&gt;
* Answer 2: &amp;lt;nowiki&amp;gt;&amp;quot;it&#039;s [[_blue_, _white_(,| and) _red_]]&amp;quot;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
it&#039;s (blue, white(,| and) red|blue, red(,| and) white|white, red(,| and) blue|white, blue(,| and) red|red, blue(,| and) white|red, white(,| and) blue) &lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
    it&#039;s blue, white, red&lt;br /&gt;
    it&#039;s blue, white and red&lt;br /&gt;
    it&#039;s blue, red, white&lt;br /&gt;
    it&#039;s blue, red and white&lt;br /&gt;
    it&#039;s white, red, blue&lt;br /&gt;
    it&#039;s white, red and blue&lt;br /&gt;
    it&#039;s white, blue, red&lt;br /&gt;
    it&#039;s white, blue and red&lt;br /&gt;
    it&#039;s red, blue, white&lt;br /&gt;
    it&#039;s red, blue and white&lt;br /&gt;
    it&#039;s red, white, blue&lt;br /&gt;
    it&#039;s red, white and blue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;.- This &#039;permutation feature&#039; has been asked quite a few times by regexp users. It is definitely &#039;&#039;not&#039;&#039; possible to obtain it by using standard Regular Expressions syntax. &lt;br /&gt;
&lt;br /&gt;
It is possible (but tedious) to write a regular expression including all the possible permutations - as in Answer 2b above - but the &#039;&#039;ad hoc&#039;&#039; syntax I am offering makes it easier to write... provided you strictly adhere to that syntax!&lt;br /&gt;
&lt;br /&gt;
Include within double square brackets the part of the Answer which will contain &#039;permutable&#039; words or phrases. You are actually allowed to have a maximum of 2 such sets of &#039;permutable&#039; words or phrases. But you cannot embed one set within another!&lt;br /&gt;
&lt;br /&gt;
Then, use pairs of underscores (the _ character) to delimit each &#039;permutable&#039; word or phrase. You can still use any of the accepted Regular Expressions characters, as explained here, in your Answers which contain one (or two) such sets of &#039;permutable&#039; words or phrases. If your Answer does not contain an even number of underscores, an Error warning will be displayed upon clicking the Show Alternate Answers button or when trying to Save your question.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;&#039;Example 5.&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
Another &#039;permutation&#039; example&lt;br /&gt;
&lt;br /&gt;
Question: &amp;quot;Quote the English proverb that is an encouragement to hard, diligent work.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Answer 1: &amp;quot;Early to bed and early to rise makes an ma healthy, wealthy and wise&amp;quot;&lt;br /&gt;
* Answer 2: &amp;quot;Early to &amp;lt;nowiki&amp;gt;[[_bed_ and early to _rise_]], makes a man [[_healthy_, _wealthy_ and _wise_]]&amp;lt;/nowiki&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Upon saving the question, Answer 2 will be automatically re-written as Answer 2b:&lt;br /&gt;
&lt;br /&gt;
Early to (bed and early to rise|rise and early to bed) makes a man (healthy, wealthy and wise|healthy, wise and wealthy|wealthy, wise and healthy|wealthy, healthy and wise|wise, healthy and wealthy|wise, wealthy and healthy)&lt;br /&gt;
&lt;br /&gt;
and it will match all the following answers:&lt;br /&gt;
&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to bed and early to rise makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to bed and early to rise makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to bed and early to rise makes a man wise, wealthy and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wealthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man healthy, wise and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, wise and healthy&lt;br /&gt;
    Early to rise and early to bed makes a man wealthy, healthy and wise&lt;br /&gt;
    Early to rise and early to bed makes a man wise, healthy and wealthy&lt;br /&gt;
    Early to rise and early to bed makes a man wise, wealthy and healthy&lt;br /&gt;
&lt;br /&gt;
===Escaping metacharacters===&lt;br /&gt;
&lt;br /&gt;
====Definition====&lt;br /&gt;
In the Regular Expressions syntax, a number of special characters or &#039;&#039;meta characters&#039;&#039; have special functions; but it is possible to force these special characters to be interpreted as normal (or &#039;&#039;literal&#039;&#039;) characters by preceding them with a so-called &#039;&#039;escape&#039;&#039; character, the backslash &amp;quot;\&amp;quot;. &lt;br /&gt;
Below is a (partial) list of those &#039;&#039;meta characters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====In Accepted Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; are Answers which have a grade greater than zero, i.e. are &#039;&#039;totally&#039;&#039; (grade = 100%) or &#039;&#039;partially&#039;&#039; (grade &amp;gt; 0% &amp;lt; 100%) &#039;&#039;correct Answers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In those Answers, if you need to use one or more &#039;&#039;meta characters&#039;&#039; for their &#039;&#039;literal&#039;&#039; value, you &#039;&#039;&#039;must&#039;&#039;&#039; &#039;&#039;escape&#039;&#039; them (i.e. precede them with a backslash). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;This computer costs 1000$ in the US.&amp;quot;, you must write the Answer as &amp;quot;This computer costs 1000\$ in the US\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 2.-&#039;&#039;&#039; If you want to accept the answer &amp;quot;Desktop computers are (usually) more powerful than laptops.&amp;quot;, you must write the Answer as &amp;quot;Desktop computers are \(usually\) more powerful than laptops\.&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* You can mix metacharacters that have a special function with others that have a literal value, within one Answer.&lt;br /&gt;
&#039;&#039;&#039;Example 3.-&#039;&#039;&#039; If you want to accept both answers &amp;quot;Computers are (usually) cheaper than cars.&amp;quot; and &amp;quot;Computers are (usually) less expensive than cars.&amp;quot;, you must write the Answer as &amp;quot;&amp;quot;Computers are \(usually\) (cheaper|less expensive) than cars.&amp;quot;&amp;quot;. &lt;br /&gt;
* In the &#039;&#039;&#039;Accepted Answers&#039;&#039;&#039; boxes you can only enter regular expressions which can generate a finite number of sentences. That is why you will not be allowed to use some &#039;&#039;meta characters&#039;&#039; which match a potentially infinite number of sentences.&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;can&#039;&#039;&#039; use for their RegExp functions:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;( ) [ ] ? |&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* List of &#039;&#039;meta characters&#039;&#039; which you &#039;&#039;&#039;cannot&#039;&#039;&#039; use for their RegExp functions, and can only be used for their &#039;&#039;literal&#039;&#039; value (and must be &#039;&#039;escaped&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * + { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The question mark (?) can be used either for its RegExp function OR, if escaped, for its &#039;&#039;literal&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4.-&#039;&#039;&#039; &amp;quot;Do you like Jack(ie)?\?&amp;quot; will accept both &amp;quot;Do you like Jack?&amp;quot; and &amp;quot;Do you like Jackie?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====In Incorrect Answers====&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Incorrect Answers&#039;&#039;&#039; are Answers which have a grade equal to zero (or None).&lt;br /&gt;
When you write those Incorrect Answers, you can use the whole range of &#039;&#039;meta characters&#039;&#039; for their special function value:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;. ^ $ * ( ) [ ] + ? | { } \ /&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For examples of use, see &#039;&#039;&#039;Detecting missing required words or character strings&#039;&#039;&#039; below.&lt;br /&gt;
&lt;br /&gt;
====Answers Validation====&lt;br /&gt;
&lt;br /&gt;
When you validate your Question, the question engine checks the validity of your expression, according to the features explained above. If an error is found, an ERROR message is displayed above the erroneous Answer(s) and you cannot save the Question until that error has been corrected.&lt;br /&gt;
&lt;br /&gt;
The validation system also checks that your parentheses and square brackets are correctly balanced.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039; The faulty Answer text is &amp;quot;underlined&amp;quot; with the list of errors, as shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Errors_en.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Detecting missing required words or character strings===&lt;br /&gt;
&lt;br /&gt;
This is a powerful feature of the RegExp question type. It will analyse the student&#039;s answer for words that are required for the answer to be correct. There are 2 ways to do this.&lt;br /&gt;
* Use what is called &amp;quot;negative lookahead assertion&amp;quot; in regular expressions syntax: &#039;&#039;&#039;^(?!.*required.*)&#039;&#039;&#039;&lt;br /&gt;
* or use an &#039;&#039;ad hoc&#039;&#039; pseudo-syntax provided in RegExp (an initial double hyphen): &#039;&#039;&#039;--.*required.*&#039;&#039;&#039;.&lt;br /&gt;
In the examples below, we shall be using the &#039;ad hoc&#039; RegExp pseudo-syntax, and sometimes give the &amp;quot;negative lookahead assertion&amp;quot; equivalent for anyone interested.&lt;br /&gt;
&lt;br /&gt;
Any Teacher Answer which begins with a double hyphen will analyse the student’s response to find out whether the following string is present or absent. If present, the analysis continues to the next question; if absent, the analysis stops and the relevant feedback message is displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*blue.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s red and white&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
Here, the . (dot) stands for “any character” and the * (asterisk) means “preceding special character repeated any number of times”. The Teacher Answer 2 regular expression above means: check whether the character string &amp;quot;blue&amp;quot;, preceded with anything and followed by anything is absent from the student&#039;s answer. Please note that the use of the asterisk is different in Moodle&#039;s &amp;quot;normal&amp;quot; Short Answer question type and in the RegExp question type.&lt;br /&gt;
&lt;br /&gt;
Actually, this syntax is not sufficient to track the absence of the word &amp;quot;blue&amp;quot; in a student&#039;s answer such as &amp;quot;it&#039;s blueish, white and red&amp;quot;. To make sure that we want to track the absence of &amp;quot;blue&amp;quot; as a word(and not just as part of a word), we must use the metacharacter \b which is an anchor which matches at a position that is called a &amp;quot;word boundary&amp;quot;. Hence the new version of our Example 4:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 4b. &#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer 2: --.*\bblue\b.*&lt;br /&gt;
* Sample student Response: &amp;quot;it&#039;s blueish, white and red&amp;quot;&lt;br /&gt;
* Feedback 2: The color of the sky is missing!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax mentioned at the beginning of this section, Teacher Answer 2 would look like this:&lt;br /&gt;
* Teacher Answer 2: &#039;&#039;&#039;^(?!&#039;&#039;&#039;.*\blue\b.*&#039;&#039;&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 5.&#039;&#039;&#039; Question: &amp;quot;Name an animal whose name consists of 3 letters and the middle letter is the vowel &#039;&#039;a&#039;&#039;&amp;quot;. &lt;br /&gt;
* Teacher Answer: &amp;quot;--^[bcr]&amp;quot;. &#039;&#039;&#039;OR&#039;&#039;&#039; * Teacher Answer: &amp;quot;--^(b|c|r)&amp;quot;.&lt;br /&gt;
* Sample student Response: &amp;quot;dog&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;Your answer should start with one of these letters: b, c or r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
In regular expressions syntax, the caret ^ stands for &amp;quot;beginning of character string to be matched&amp;quot;, while the dollar sign $ stands for &amp;quot;end of character string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(blue|red|white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s black and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not even found one of the colors of the French flag!&amp;quot;&lt;br /&gt;
* Sample student Response #2: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among those listed between brackets and separated by the | sign. As soon as one of those words is found, the &amp;quot;missing condition&amp;quot; is considered false, and the response analysis continues to the next Answer&#039;s regular expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;^(?!.*(blue|red|white).*)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 7.&#039;&#039;&#039; Question &amp;quot;What are the colors of the French flag?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Teacher Answer: &amp;quot;--.*(&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;blue&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;red&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;white).*&amp;quot;&lt;br /&gt;
* Sample student Response #1: &amp;quot;It&#039;s blue and orange.&amp;quot;&lt;br /&gt;
* Feedback: &amp;quot;You have not found all the colors of the French flag&amp;quot;.&lt;br /&gt;
* Sample student Response #2: &amp;quot;white blue red&amp;quot;.&lt;br /&gt;
* Feedback: None, the analysis continues to the next Teacher Answer expression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;.- The regular expression looks for a missing word among all of those listed between brackets and separated by the &amp;amp;&amp;amp; double character combination. Only if all of those words are present, will the &amp;quot;missing condition&amp;quot; be considered false, and the response analysis continue to the next Answer&#039;s regular expression. Please note that the list of parenthesized words must begin with the &amp;amp;&amp;amp; character sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note.-&#039;&#039;&#039;&lt;br /&gt;
Using the &amp;quot;negative lookahead assertion&amp;quot; syntax, Teacher Answer would look like this: &#039;&#039;&#039;(^(?!.*(blue).*)|^(?!.*(white).*)|^(?!.*(red).*))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Editing a regular expression question===&lt;br /&gt;
&lt;br /&gt;
[[Image:settings01.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Help Button Mode====&lt;br /&gt;
&lt;br /&gt;
Selecting a mode other than &#039;&#039;None&#039;&#039; will display a button to enable the student to get the next letter or word (including the very first letter or word).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive mode&#039;&#039; the button displayed will say &amp;quot;Buy next letter&amp;quot; or &amp;quot;Buy next word&amp;quot; according to the mode selected by the teacher. For setting the &amp;quot;cost&amp;quot; of buying a letter or word, see the &#039;&#039;Penalty for incorrect tries and Buying a letter or word&#039;&#039; settings further down the Edit form.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Adaptive No penalty&#039;&#039; mode the button displayed will say &amp;quot;Get next letter&amp;quot; or &amp;quot;Get next word&amp;quot;&lt;br /&gt;
&lt;br /&gt;
By default the Help button mode value is set at &#039;&#039;&#039;None&#039;&#039;&#039;. The Help button will only be available to quizzes that have their &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode set to &#039;&#039;Adaptive&#039;&#039; or &#039;&#039;Adaptive (no penalties)&#039;&#039; as it does not make sense to enable the Help button for non-adaptive tests.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;casesensivity&amp;quot;&amp;gt;Case sensitivity&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
The editing form features a &#039;&#039;Case sensitivity&#039;&#039; setting, which is valid for &#039;&#039;all of the answers&#039;&#039; of the current question. You should not add an &#039;&#039;&#039;/i&#039;&#039;&#039; parameter at the end of your regular expressions. You may need to edit questions authored in 1.9 when you upgrade to 2.0 and remove any &#039;&#039;&#039;/i&#039;&#039;&#039; parameters from your regular expressions.&lt;br /&gt;
&lt;br /&gt;
====Show alternate answers to student====&lt;br /&gt;
Show all correct alternative answers to student when on review page? If there are a lot of automatically generated correct alternative answers, displaying them all can make the review page quite long. So, you may wish to &#039;&#039;not&#039;&#039; display all those alternative correct answers. The first correct answer will always be displayed, under the label &amp;quot;The best correct answer is:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span id=&amp;quot;firstcorrect&amp;quot;&amp;gt;First correct answer&amp;lt;/span&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
For Answer 1 you must enter an answer text which a) is the &amp;quot;best&amp;quot; possible answer; b) is &#039;&#039;&#039;not&#039;&#039;&#039; a regular expression or - more exactly - &#039;&#039;will not be interpreted as a regular expression&#039;&#039; but &amp;quot;as is&amp;quot; and c) has a Grade value of 100%. You will notice that when you create a new RegExp question the Grade value for Answer 1 is already automatically set at 100% and cannot be changed.&lt;br /&gt;
&lt;br /&gt;
Note.- There are two ways to enter an answer containing meta characters, according to whether this is Answer 1 or any of the subsequent Answers. Exemple question: how much did your computer cost?&lt;br /&gt;
&lt;br /&gt;
Answer 1: It cost $1,000.&lt;br /&gt;
&lt;br /&gt;
Answer 2: It cost ( me)?\$1,000\.&lt;br /&gt;
&lt;br /&gt;
In Anwer 1 you just type the expected answer &amp;quot;as is&amp;quot;. The text in Answer 2 will be interpreted as a regular expression, and thus you need to escape the two meta characters (the $ sign and the end-of-sentence full stop). Note that here I have added the optional pronoun &amp;quot;me&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other answers====&lt;br /&gt;
&lt;br /&gt;
Any answers with a Grade higher than 0% must be entered as valid regular expressions &#039;&#039;which can yield acceptable alternative answers&#039;&#039; (regardless of the Grade being less than 100%).&lt;br /&gt;
&lt;br /&gt;
For example, you cannot enter the following Answer with a grade greater than zero:&lt;br /&gt;
&lt;br /&gt;
.*blue, white(,| and) red.*&lt;br /&gt;
&lt;br /&gt;
The reason is that this expression would accept as correct (with a non-null grade) an infinity of answers, many of which would be incorrect, e.g.: &amp;quot;My hat it blue, white, red and orange&amp;quot;, &amp;quot;The French flag is blue, white, red, black and nice&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
If you try to do so, validation of your question will fail and an error message will be displayed to tell you where you went wrong.&lt;br /&gt;
&lt;br /&gt;
This means that some regular expressions, which are perfectly valid and would correctly analyse the student&#039;s (correct) answer are not recommended. The only case where they would work is a) if your question&#039;s &#039;&#039;&#039;Display Hint Button&#039;&#039;&#039; is set at No and b) your quiz &#039;&#039;&#039;Adaptative Mode&#039;&#039;&#039; is set at No. This means that you must &#039;&#039;not&#039;&#039; enter as an answer with a grade higher than 0% a regular expression beginning with a double hyphen &amp;quot;--&amp;quot;, used for detecting missing character strings.&lt;br /&gt;
&lt;br /&gt;
====Show/Hide alternate answers====&lt;br /&gt;
&lt;br /&gt;
When you are creating (or modifying) a RegExp question, you may want to make sure that all the alternative correct answers that you have created in the Answers fields will work. You can click the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button to calculate and display all the correct answers in the form you are editing. This may take quite some time on your server, depending on the number and complexity of the regular expressions you have entered in the Answer fields!&lt;br /&gt;
&lt;br /&gt;
On the other hand, it is the recommended way to check that your &amp;quot;correct answers&amp;quot; expressions are correctly written. Here is an example.&lt;br /&gt;
&lt;br /&gt;
Please remember that only Answers regular expressions with a score greater than zero will be used to calculate those alternative answers.&lt;br /&gt;
&lt;br /&gt;
Please note that clicking the &#039;&#039;&#039;Show alternate answers&#039;&#039;&#039; button will perform an analysis of all the regular expressions you entered in the Answers field. If a syntax error is detected at this stage, the alternative correct answers will &#039;&#039;not&#039;&#039; be displayed, and an &#039;&#039;ad hoc&#039;&#039; error message will displayed above the faulty regular expression.&lt;br /&gt;
&lt;br /&gt;
[[Image:showhidealternateanswers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Previewing questions in popup window (teacher only)===&lt;br /&gt;
&lt;br /&gt;
When the teacher previews a question in the popup preview question window they can display all of the acceptable alternative answers. Those alternative answers are automatically generated from the regular expressions you have entered when creating the question which carry a grade higher than 0%. The very first acceptable answer is printed as is at the top of the list. This is followed by all the other alternative acceptable answers, consisting of a) the Grade attributed; b) a reminder of the regular expression you entered and c) a list of all alternative answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:alternate_answers.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Automatic formatted extra feedback===&lt;br /&gt;
Please note that the RegExp question can be used in any &#039;&#039;&#039;Question behaviour&#039;&#039;&#039; mode. However, it is advised to create quizzes containing only RegExp questions or containing other types of questions, but &#039;&#039;preferably&#039;&#039; if the quiz&#039;s &#039;&#039;&#039;&#039;&#039;Question behaviour / How questions behave&#039;&#039;&#039;&#039;&#039; setting is set to &#039;&#039;Adaptive mode&#039;&#039; (with or without penalty).&lt;br /&gt;
&lt;br /&gt;
When a student (or teacher in Preview Question mode) submits a response to a RegExp question, 3 types of feedback messages are displayed (in Adaptive mode).&lt;br /&gt;
&lt;br /&gt;
* (line 3) The standard correct/incorrect Quiz message (plus the color associated with either state).&lt;br /&gt;
* (line 2) The Feedback message entered by the question creator for each Teacher Answer.&lt;br /&gt;
* (line 1) An extra feedback system is automatically provided, displaying the student&#039;s submitted response, with the following format codes:&lt;br /&gt;
** the beginning of the student&#039;s submitted response which best matches one of the Alternate Answers is displayed in blue;&lt;br /&gt;
** any words from the submitted response which are present in the potential Alternate Answers following the initial correct part submitted are colored in red;&lt;br /&gt;
** any words not present in the potential Alternate Answers following the initial correct part submitted are colored in red and formatted as strike-through.&lt;br /&gt;
The meaning of those colors etc. may need to be explained to the student before they take the quiz, especially the difference between &amp;quot;red&amp;quot; and &amp;quot;red plus strike-through&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:regexp_colored_feedback_21.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Feedback given by the Help button===&lt;br /&gt;
&lt;br /&gt;
Each time a student clicks the &#039;&#039;&#039;Buy/Get next letter/word&#039;&#039;&#039; button to buy/get a letter/word, that letter or word is added to his response. The last line of the feedback zone shows the following information: added letter/word; penalty cost (if applicable); total penalties so far (if applicable). Note that if the total of penalties exceeds 1 (i.e. 100%), that total is displayed in red. &lt;br /&gt;
&lt;br /&gt;
When the teacher views the quiz results, on the &#039;&#039;&#039;&#039;Review Attempt&#039;&#039;&#039;&#039; pages, &#039;&#039;&#039;&#039;History of responses&#039;&#039;&#039;&#039; section, the response history shows &#039;&#039;Submit (with a request for help)&#039;&#039; with the response states before and after the letter/word was added.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-addedletterhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Image:21-addedwordhistory.jpg]]&lt;br /&gt;
----&lt;br /&gt;
If the student clicked the &#039;&#039;&#039;Buy/Get next word&#039;&#039;&#039; button while his current submitted answer contained the beginning of a (correct) word, the full correct word is displayed in the Answer field, and the feedback message says &amp;quot;&#039;&#039;Completed&#039;&#039; word&amp;quot; rather than &amp;quot;&#039;&#039;Added&#039;&#039; word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:21-completedwordhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Display right answers===&lt;br /&gt;
&lt;br /&gt;
If your Quiz settings &#039;&#039;Review options&#039;&#039; are set to display the Right answer (During the attempt or Immediately after the attempt etc.), and your question&#039;s &#039;&#039;Show alternate answers to student&#039;&#039; setting is set to &#039;&#039;&#039;Yes&#039;&#039;&#039;, when the student has submitted his attempt, and is reviewing his answers, all of the possible answers will be displayed, as shown in this screenshot. Correct responses with a grade &amp;lt; 100% are also listed, with their grade value.&lt;br /&gt;
&lt;br /&gt;
Please note that the &#039;&#039;teacher&#039;&#039; will always be able to see that &amp;quot;other accepted answers&amp;quot; section when reviewing the Quiz answers.&lt;br /&gt;
&lt;br /&gt;
[[Image:23 correct responses.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Inserting RegExp sub-questions in Cloze type questions===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Important notice&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
The RegExp question type is &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; recognized by the standard Moodle Cloze question type. If you want to use it you&#039;ll have to replace 2 files (&#039;&#039;renderer.php&#039;&#039; and &#039;&#039;questiontype.php&#039;&#039;) on your &#039;&#039;&amp;lt;yourmoodle&amp;gt;/question/type/multianswer&#039;&#039; with the hacked files available from the links below.&lt;br /&gt;
&lt;br /&gt;
https://raw.github.com/rezeau/moodle/multianswer_regexp-26/question/type/multianswer/questiontype.php&lt;br /&gt;
&lt;br /&gt;
https://raw.github.com/rezeau/moodle/multianswer_regexp-26/question/type/multianswer/renderer.php&lt;br /&gt;
&lt;br /&gt;
Note.- If you are interested in comparing the 2 &amp;quot;standard&amp;quot; Moodle 2.6 multianswer files with the &amp;quot;RegExp hacked&amp;quot; files, go to &lt;br /&gt;
&lt;br /&gt;
https://github.com/rezeau/moodle/compare/MOODLE_26_STABLE...multianswer_regexp-26&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Syntax for inserting RegExp sub-questions in Cloze type questions.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;REGEXP&#039;&#039;&#039; or shorter &#039;&#039;&#039;RX&#039;&#039;&#039; coding for questions which ignore case&lt;br /&gt;
&lt;br /&gt;
* The colors of the French flag are {:REGEXP:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RX:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will accept &amp;quot;blue, white and red&amp;quot; as a correct answer as well as &amp;quot;Blue, White and Red&amp;quot;&lt;br /&gt;
&lt;br /&gt;
use &#039;&#039;&#039;REGEXP_C&#039;&#039;&#039; or shorter &#039;&#039;&#039;RXC&#039;&#039;&#039; coding for questions in which case matters&lt;br /&gt;
* The colors of the French flag are {:REGEXP_C:=blue, white and red#Correct!}.&lt;br /&gt;
* The colors of the French flag are {:RXC:=blue, white and red#Correct!}.&lt;br /&gt;
&lt;br /&gt;
Will not accept &amp;quot;Blue, White and Red&amp;quot; as a correct answer (wrong capital letters).&lt;br /&gt;
&lt;br /&gt;
Please note that, as explained above, the very first answer &#039;&#039;must&#039;&#039; be Graded 100% (in Cloze type question syntax, all correct is either &#039;&#039;&#039;=&#039;&#039;&#039; or &#039;&#039;&#039;100%&#039;&#039;&#039;) and it must &#039;&#039;not&#039;&#039; be a regular expression.&lt;br /&gt;
&lt;br /&gt;
Please note that the syntax of the sub-questions inside a Cloze-type question must be followed exactly and that you must never ever copy and paste any question text from e.g. a word-processor into the Cloze-type question editing window. Quite often Cloze-type questions yield errors because extraneous blank spaces, new lines, or any odd formatting character has made its way into the question text.&lt;br /&gt;
&lt;br /&gt;
Note that the &#039;&#039;Hint&#039;&#039; button is not available for a RegExp question embedded in a Cloze-type question.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
====Downloads====&lt;br /&gt;
* Download [http://moodle.org/plugins/view.php?plugin=qtype_regexp the Regexp question type] from the Moodle Plugins repository.&lt;br /&gt;
* IMPORTANT : Starting with the 2.2 version of REGEXP, if you want the Help feature, you must also download and install the following 2 &amp;quot;question behaviours&amp;quot; from the Moodle Plugins repository: [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelp RegExp Adaptive mode with Help]  and [http://moodle.org/plugins/view.php?plugin=qbehaviour_regexpadaptivewithhelpnopenalty RegExp Adaptive mode with Help (no penalties)].&lt;br /&gt;
&lt;br /&gt;
====Installation====&lt;br /&gt;
-------------------------------&lt;br /&gt;
If you have downloaded the zip archive from the new moodle.org plugins page&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3.- GO TO STEP 4 below&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
If you have downloaded the zip archive from https://github.com/rezeau/moodle-qtype_regexp (&#039;&#039;&#039;for latest developments&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
1.- Unzip the zip archive to your local computer.&lt;br /&gt;
&lt;br /&gt;
2.- This will give you a folder named something like &amp;quot;rezeau-moodle_qtype_regexp-ff8c6a1&amp;quot;. The end of the name may vary.&lt;br /&gt;
&lt;br /&gt;
3.- ***Rename*** that folder to &amp;quot;regexp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
4.- Upload the regexp folder to &amp;lt;yourmoodle&amp;gt;/question/type/ folder.&lt;br /&gt;
&lt;br /&gt;
5.- Visit your Admin/Notifications page so that the new question type gets installed.&lt;br /&gt;
&lt;br /&gt;
====Learn more about regular expressions====&lt;br /&gt;
&lt;br /&gt;
*[http://www.regular-expressions.info/tutorial.html Regular Expressions Tutorial] A complete introduction to the topic.&lt;br /&gt;
*[http://www.regexplanet.com/simple/index.html Regular Expression Test Page] Test your regular expressions on a variety of &amp;quot;answers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Other Moodle question types based on regular expressions====&lt;br /&gt;
[https://docs.moodle.org/dev/The_OU_PMatch_algorithm The OUP&#039;s PMatch]&lt;br /&gt;
&lt;br /&gt;
[https://docs.moodle.org/20/en/Preg_question_type Oleg Sychev&#039;s Preg question type]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:question/type/regexp]]&lt;br /&gt;
[[es:Tipo de pregunta respuesta corta de expresión regular]]&lt;/div&gt;</summary>
		<author><name>Rezeau</name></author>
	</entry>
</feed>