Regular expression short answer

Question types ::: qtype_regexp
Maintained by Joseph Rézeau, Nicolas Dunand
This question type (for the Moodle quiz module) aims at a more advanced system of student's response analysis, through the use of regular expresssions. This question type is an extension of the SHORTANSWER type. It can be used on its own and can also be incorporated into the existing Cloze (embedded) question type.

Regular expression short answer 3.11.1 for Moodle 3.1-3.11

Moodle 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
Released: Monday, June 28, 2021, 9:36 PM
version 2019052100 for moodle 3.7
version 2019052101
added the inline input feature for the mobile version (based on same feature for short answer question for mobile)
version = 2019011301
- Version Halloween 2018 has many changes
- Switching maintainance from Nicolas Dunand back to Joseph R�zeau
- With many thanks to Nicolas for his maintainance work in the past 4 years!
- changed CSS rules of misplaced words and wrong words for a better display
- added a 3rd Help option: Get or buy one word OR one punctuation mark
- added compliance with the Moodle Mobile App
- made code totally compliant with Moodle codechecker and Moodle PHPdoc
- plus a number of minor bug fixes and small improvements to the response analysis
version = 2013111801
Fixed incorrect processing of utf8 characters between []
See this discussion: (FR)

version 2012102900
- removed French fr from lang folder (moved to AMOS)
- added permutation feature: up to 2 sets of "permuted" words or phrases can be used in regular expression
- use the print_collapsible_region feature to display/hide alternate answers on Preview and Quiz review pages
- fixed fix potential html format tags inside correct answers
- fixed correctanswersare if no alternate answers
- fixed ignorecase bugs
- added a require to locallib (needed for multianswer integration of remove_blanks)
- fixed escaped question mark bug
- fixed extra blanks problem
- compliance with Strict Standards
- restored General Feedback field to avoid "missing GF" error in 2.3
- fixed summarise_response_withhelp
- made compliant with new optional_param_array method in moodle 2.3 / not retro-compatible

version 2012022600
- accept to give letter or word hint even with empty student answer
- display misplaced words in student answer even if nothing matches at beginning of answer
- removed obsolete showhint and addnextletter functions from module.js
version = 2012011000 (no version number change)
added studentshowalternate option and updated XML table to add studentshowalternate field in qtype_regexp table (options)
added display alternative correct answers feature in question edit form
version = 2012011000
- added backup/moodle1/lib.php to restore regexp questions from 1.9 backups
- reverted table qtype_regexp_options to previous name qtype_regexp
(pending decision by Tim Hunt to standardize question options table names)
- updated backup/moodle1/backup and restore files to follow current naming conventions
- ditto for questiontype.php file and db/upgrade.php
version 2011122101
- added words hint feature (needs 2011122101 versions of regexpadaptivewithhelp and regexpadaptivewithhelpnopenalty to work)
version 2011121701
- moved calculation of alternateanswers to locallib function get_alternateanswers($question)
- stored/cached alternateanswers array in $SESSION for better performance

Version information

Version build number
Version release name
3.11.1 for Moodle 3.1-3.11
Stable version
MD5 Sum
Supported software
Moodle 3.1, Moodle 3.2, Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6, Moodle 3.7, Moodle 3.8, Moodle 3.9, Moodle 3.10, Moodle 3.11
  • Latest release for Moodle 3.1
  • Latest release for Moodle 3.2
  • Latest release for Moodle 3.3
  • Latest release for Moodle 3.4
  • Latest release for Moodle 3.5
  • Latest release for Moodle 3.6
  • Latest release for Moodle 3.7
  • Latest release for Moodle 3.8
  • Latest release for Moodle 3.9
  • Latest release for Moodle 3.10
  • Latest release for Moodle 3.11

Version control information

Version control system (VCS)
VCS repository URL

Default installation instructions for plugins of the type Question types

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder (eg "myquestiontype") in the "question/type" subdirectory.
  4. Visit to finish the installation