Ignore spaces

Re: Ignore spaces

by Joseph Rézeau -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi John,

It might help if you said which QUESTION is asked to which you are expecting this answer.

A simple way to reduce acceptable answers would be to give clear instructions to the student, e.g. "do not use any blanks/spaces in your answer" OR "please separate ALL elements of your answer with blanks/spaces".

The REGEXP question type was primarily aimed at analysing answers written in "natural language", not maths or physics formulas, etc. However, it is possible to achieve what you want by entering those 2 formulas which will accept answers with or without blanks.

Formula #1: see below

will accept 128 possible answers, such as:

M = (N % 3 ) * 4
    M = (N % 3 ) *4
    M = (N % 3 )* 4
    M = (N % 3 )*4
    M = (N % 3) * 4
    M = (N % 3) *4
    M = (N % 3)* 4
    M = (N % 3)*4
    M = (N %3 ) * 4
    M = (N %3 ) *4
    M = (N %3 )* 4
    M = (N %3 )*4
    M = (N %3) * 4
    M = (N %3) *4
    M = (N %3)* 4
    M = (N %3)*4
    M = (N% 3 ) * 4
    M = (N% 3 ) *4
    M = (N% 3 )* 4
    M = (N% 3 )*4
    M = (N% 3) * 4
    M = (N% 3) *4
    M = (N% 3)* 4
    M = (N% 3)*4
    M = (N%3 ) * 4

etc.

Further to Marcus Green's suggestion, this formula will accept an inversion:

Formula #2: see below

will also accept 128 possible answers including:

M = 4 * (N % 3 )
M = 4 * (N % 3)
M = 4 * (N %3 )
M = 4 * (N %3)
M = 4 * (N% 3 )
M = 4 * (N% 3)
M = 4 * (N%3 )
M = 4 * (N%3)
M = 4 *(N % 3 )
M = 4 *(N % 3)
M = 4 *(N %3 )
M = 4 *(N %3)
M = 4 *(N% 3 )
M = 4 *(N% 3)

etc.

EDIT the text editor on this forum modifies my reg expressions so I have attached them as pics.

Hope that helps. Don't thank me, as POTUS would tweet "I am a genius", even if I say so myself.wink

Attachment 2018-01-15_13-59-38.jpg