Preg and CorrectWriting 2.8 Released at last.

Preg and CorrectWriting 2.8 Released at last.

by Oleg Sychev -
Number of replies: 2
Picture of Core developers Picture of Plugin developers

I know we are long overdue with new releases of Preg and CorrectWriting questions - especially Preg that had problems under Moodle 2.8, 

But we needed that long stop to work on really challenging new features, which required much time and effort to develop.

CorrectWriting 2.8 new features:

  • typo analysis - the question could now find typos in the student's response, including extra and missing separators between words and typos in the words themselves; this feature can be used alone or with sequence analysis - written by Maria Birukova with help from Dmitriy Mamontov
  • enumeration analysis - enumeration is a part of the answer, where elements could be placed in any order. With enumeration analysis enabled, you can enter only one variant instead of all possible orders. For now it's enabled only for C++ programming language (based on the features of the language it can find enumeration automatically), but interface for entering english-language enumeration is worked on. Thanks goes to Vladimir Klevtsov.

Preg 2.8 new features:

  • a new mode for Full, 100% correct support for simple assertions - you can even generate hints for regexes like  [a!]\b[b?]\b[c.]\b[d!]\be   or  [a!]\b[b?]\b[c.]\b[d!]\b\? and get correct hinting results in any place. This makes regex matching roughly two times slower, so you have an admin option to retain old, Fast mode in case you will experience performance problems. Thanks go to the Elena Lepilkina and Valeriy Streltsov.
  • support for subexpressions recursion operator in FA matcher - you can get hints for regexes defining a strings with arbitrary correctly nested parenthesis for now -Valeriy Streltsov
  • subexpression recursion can make you regexes rather complex and unreadable, so there goes a convenient templates function - you can use several predefined templates to make you regexes easier, for example (?###parens_opt<)a\+b(?###>) will match with a+b inside any number of correctly closed parenthesis or without them - e.g. a+b  ((a+b)) (((((((((a+b))))))))) etc - full list of templates can be found on https://docs.moodle.org/28/en/Preg_question_type#Templates - Oleg SychevValeriy StreltsovGrigory Terekhov and Vladimir Ivanov all worked on this.
  • if you will write a regex that can not match at all (it can be done using simple assertions), it will be detected and shown as error on saving question - Elena Lepilkina and Valeriy Streltsov
  • conditional subpatterns are now supported in FA matcher - allowing you to write regexes with conditined alternatives  - and you can get hints for them - Valeriy Streltsov
I will check both questions working on Moodle 2.9 in the near time and will made a quick fix releases if necessary.

Average of ratings: Useful (1)
In reply to Oleg Sychev

Re: Preg and CorrectWriting 2.8 Released at last.

by Germán Valero -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Oleg,

Congratulations in this great plugin update.


When I was translating the preg question type at AMOS I noticed a strange-looking string name and content: 


char_code_disallowed_node_error 'Unicode code points 0xd800 ... 0xdfff are now allowed'


As I am not a programmer, nor a native English speaker, I am doubting if the 'disallowed' would not mean 'not allowed' instead of 'now allowed'


Thanks in advance for your help.


Average of ratings: Useful (1)
In reply to Germán Valero

Re: Preg and CorrectWriting 2.8 Released at last.

by Oleg Sychev -
Picture of Core developers Picture of Plugin developers

Thanks, German. That was a typo of course. 

I fixed it in our repository, but I hope it could wait for the next release. This message is actually very rare and tied with full Unicode support. I could not even tell exact way for a student or teacher to enter such characters.