WeBWorK Main Forum

raw student input

Re: raw student input

by Davide Cervone -
Number of replies: 0
It was really the initial ^ that was the problem. The patterns are used within a loop that uses the \G item to maintain the current location within the string, and I had though that ^ was relative to that, but it isn't. It wasn't necessary to have them in the string pattern (I had used them only to reinforce the idea that it would be matching the entire student input). it does mean, however, that the student's answer isn't quite exactly what they typed, because initial spaces are trimmed (by the parser as part of the parsing process). I suspect that is not critical to very many applications, and if it is, one can always use $ans->{student_ans} instead.

Davide