Posts made by Joseph Rézeau

Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Oleg,
I have fixed the square brackets bug in REGEXP (should be downloadable from CVS latest very shortly). The following answers should do what you want: accept zero or one blank space between characters; please note that any extra blank space (more than one) will be automatically deleted from student's response. I do not see the point of accepting an unlimited number of semi colons (;) at the end of the expression.
Answer 1 : y=str[1][1];
Answer 2: y ?= ?str ?\[ ?1 ?\] ?\[ ?1 ?\] ?;
Note that space followed by ? means 0 or 1 space; note that the square brackets must be escaped, i.e. preceded by a backslash (unlike in Answer 1 which is not treated as a regular expression).
This will accept a grand total of 512 different responses:
y = str [ 1 ] [ 1 ] ;
y = str [ 1 ] [ 1 ];
y = str [ 1 ] [ 1] ;
y = str [ 1 ] [ 1];
y = str [ 1 ] [1 ] ;
y = str [ 1 ] [1 ];
y = str [ 1 ] [1] ;
y = str [ 1 ] [1];
y = str [ 1 ][ 1 ] ;
y = str [ 1 ][ 1 ];
y = str [ 1 ][ 1] ;
y = str [ 1 ][ 1];
y = str [ 1 ][1 ] ;
y = str [ 1 ][1 ];
y = str [ 1 ][1] ;
y = str [ 1 ][1];
y = str [ 1] [ 1 ] ;
y = str [ 1] [ 1 ];
etc.
It will also accept: y = str [ 1] [ 1 ] ; which will be automatically rewritten as y = str [ 1] [ 1 ] ;
etc.
Joseph
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Jared > "You might say, just turn HTML editor on by default in my profile, but if I do that it often breaks my {:MULTICHOICE} options onto new lines."

I always use the HTML editor and I do not have this problem. You might also enable the HTML editor and, when you notice weird line formatting, toggle to the HTML Source just to check things.

Joseph