Your Moodle version

Question types: Pattern match

Maintained by Tim at Lone Pine Koala Sanctuary Tim Hunt, Picture of Jamie Pratt Jamie Pratt, Picture of Phil Butcher Phil Butcher
Allows a short response of one or a few sentences that is graded by comparing against various model answers, which are described using the OU's pattern match syntax.

There are working examples in eAssessment with Moodle on our OpenLearn site.

The documentation is in How to create questions in Moodle on that site.


This plugin is part of set Open University.


Screenshot #0


Tim at Lone Pine Koala Sanctuary
Tim Hunt (Lead maintainer)
Picture of Jamie Pratt
Jamie Pratt: Developer
Picture of Phil Butcher
Phil Butcher: Question type designer
Picture of Colin Chambers
Colin Chambers: Developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Laurent Repond
    Sat, Sep 20, 2014, 8:56 PM
    Hi everyone. This is a great tool however I am having a little trouble with it and was wondering if anyone could help? It does not recognise the number '0' as a valid response. Equally, it does not accept zero as part of a statement like '0 ms-1' as a valid response. In the first case I have tried match(0) and in the second I have tried match_mow(0 ms-1). Any ideas?
  • Picture of Phil Butcher
    Mon, Sep 22, 2014, 4:47 PM
    That's a bug. Maybe one we've introduced recently. I'll look into it.
  • Picture of Phil Butcher
    Tue, Sep 23, 2014, 12:16 AM
    On closer inspection Tim Hunt points out that another correspondent, J Hoopes, has already pointed this out to us and has suggested the solution. We're aiming to fix it for our next release in December. If you want to fix your local system before then J Hoopes sent us this

    "In the pmatch_matcher_number class in the match word function, you normalize the number and then check for a tolerance. If the word to match is 0, the tolerance can't validate as 0 < 0 will always be false. so changing it to 0 <= 0 fixes the problem.""
  • Picture of Alan Kmiecik
    Thu, Oct 30, 2014, 9:06 PM
    So pmatch shows up in my plugin check, I get to this site and there are no install instructions. How about what folder does it go in?
  • Tim at Lone Pine Koala Sanctuary
    Thu, Oct 30, 2014, 10:22 PM
    Have you read

    Since this is a question type, it goes in question/type/pmatch, as it says at the bottom of
  • Picture of Derek Howden
    Sat, Dec 6, 2014, 4:03 AM
    I have tried installing this on Moodle 2.7 and it reports no spellcheck available. I have enabled the TinyMCE spell checking but doeesn't make any difference. I've searched the plugins for one. Any ideas please? I'm stumped
  • Picture of Phil Butcher
    Mon, Dec 8, 2014, 7:37 PM
    Pmatch works with either pspell or enchant spell checking. These are backend systems. Google 'php spelling checker'.
  • Picture of Joe Harris
    Tue, Jul 14, 2015, 8:28 PM
    Having an issue with questions where the pattern is looking for multiple matches in the same sentence, e.g. 'as x increases, y decreases' where I'm trying to match both the 'x increases' and 'y decreases' parts. The same answer works just fine if I put a full stop in between clauses, but doesn't detect a match for a single sentence. I'm quite wiling to accept I'm doing something silly, but any help would be highly appreciated.
  • Picture of Phil Butcher
    Wed, Jul 15, 2015, 3:16 AM
    Would match_p0 (x_inc* y_dec*) give you what you want? i.e. x must be immediately followed by inc(reases) (proximity of 0 words between x and inc*) and y immediately followed by dec(reases))?
  • Picture of Phil Butcher
    Wed, Jul 15, 2015, 3:21 AM
    Should of course have added the o and w matching options too so that any order of 'y decreases x increases' will work as well as allowing extra words. So complete it's match_owp0 (x_inc* y_dec*). Will that do what you want?
  • Picture of Joe Harris
    Wed, Jul 15, 2015, 8:55 PM
    Hi Phil,
    Thanks, the minimal working example always elucidates things! My syntax was off in the match. Should have read the documentation more thoroughly!
  • Picture of umapathi duttuluru
    Thu, Nov 19, 2015, 8:03 PM
    Hi Tim/jamie/jil,

    Thanks for your hardwork providing us pattern match question type

    I have tried to create the pattern match question type when i entered the text "match_mow(Talk about what happened to the rooms in the house and why they couldn’t stay in a hotel Use two sentences)" in the "Answer" field then click "Submit".

    It shows error message "Missing closing bracket in code fragment "match_mow(Talk about what happened to the rooms in the house and why they couldn".

    Please let us know how to allow single quotes like "couldn’t".

    Thanks for your help in advance.

  • Tim at Lone Pine Koala Sanctuary
    Thu, Nov 19, 2015, 10:39 PM
    I think you escape single quotes with a \. So couldn\’t

    Note that the question type works better if you just try to match the keywords, not every word in the sentence.
  • Picture of umapathi duttuluru
    Sat, Nov 21, 2015, 5:56 PM
    Hi TIm,

    Thank you for your quick reply.

    "match_mow(Talk about what happened to the rooms in the house and why they couldn’t stay in a hotel Use two sentences)"

    Sorry in the above content it is not "single quote" it is given as a "left single curly quote"

    ‘ ‘ ‘ left single curly quote

    Thanks for your help.

  • Tim at Lone Pine Koala Sanctuary
    Tue, Nov 24, 2015, 2:02 AM
    Sorry, I am not sure without some in-depth debugging that I don't have time to try now.

    Can you just avoid using that character?
1 2
Please login to post comments