Moodle Plugins directory: Perl-Compatible Regular Expression | Moodle.org
Perl-Compatible Regular Expression
Question types ::: qtype_preg
Maintained by
Oleg Sychev
Part of set Perl-Compatible Regular Expression Set.
A question that could check student's response against several regular expressions and could give next character and next word hints.
If you do not know what regular expression is, it could also work like Moodle Shortanswer question with hints, just choose "Moodle shortanswer" as notation and you could enter answers just like in shortanswer question type.
Latest release:
51 sites
16 downloads
7 fans
Current versions available: 9
This question requires 5 other plugins to work. If you want easy install, download full archive from our BitBucket site. You could unpack it into Moodle core folder (the one with config.php) and it will place anything where it belongs.
If you want to fully use Authoring Tools, you should also have Open Source Graphviz packet installed and path to it specified into Moodle. It is necessary to draw Syntax Tree and Explaining Graph.
Contributors
Oleg Sychev (Lead maintainer): Idea, design, question type and behaviours code, hinting, error reporting, regular expression testing (authoring tool)
Valeriy Streltsov: Regex parsing, NFA regex matching engine, matchers testing, backup&restore, unicode support, selection in regex text (in authoring tools)
Dmitry Pahomov: Regex description (authoring tool)
Vladimir Ivanov: Explaining graph (authoring tool)
Grigory Terekhov: Syntax tree (authoring tool)
Elena Lepilkina: Assertions support
Artem Prokudin: Typo detection
Please login to view contributors details and/or to contact them
"blue, white, red". Is it possible to add an matching engine which goes through all answers and calcs additive the matching percents, eg.:
33% for .*blue.*
33% for .*white.*
33% for .*red.*
(-10% for not .*,.*and.*)
? This would strongly simplify the permutations of partly correct answers.
Regular expressions are used to write all kind of nasty thing, they can be non-linear, use repetitions, backreferences, recursion etc. I can not imagine right now how what you want should behave for complex regular expression. If you still wish to discuss this to example - let's do it on the tracker (link above). But I think than CorrectWriting question will give you what you want without regular expressions.
I think, to grade fully correct answers with regex is a trivial thing. The difficult job is to grade partially correct answers.
My idea was to search (with regex) in the student's answer for special expressions and have points for it.
e.g: in Java: for(int i=0;i<10;i++)
One regex checks for fully correctness; if not a serie of regexes looks for correct parts like
"int i=0" or "i<10|i<=9" or "i++|i+=1|i=i+1|i=1+i" or "for(.*;.*;)"
and have 30%+30%+30%+5% points for it. A student answer can have a combination of errors, but the correct parts give percents of points.
This is what I meant. Each regex needs two fields for successor regexes for matched / unmatched. (like in the math plugin STACK). So it is possible to build up a decision tree with matching or unmatching regexes. (Sure, I can use use the math plugin and take usage of maxima's regex capabilities, but this plugin is more performant)
What unit tests file gives failure to you? If you run cross_tests.php (more than 2500 tests) there are tests that are expected to break for several very obscure cases. There are also 1-2 obsolete unit-tests files probably too.