[LON-CAPA-users] Regular expressions in string response
lon-capa-users@mail.lon-capa.org
lon-capa-users@mail.lon-capa.org
Tue, 1 May 2007 08:33:59 -0400
I am trying to set up a string response question that takes the student
answer and removes blanks before comparing to the correct answer. Hopefully
someone has a code snippet that does this?
Student input:
a b c
I want to match to
/^(abc|acb|bca)\b)
(Incidentally, what does the "b" do in this expression?)
I am looking for something like the vi command to remove spaces:
s/ //g
I see the FAQ example of using regular expressions, but this only shows the
multiple string comparison. I don't know how to scan the input answer
string. Something with $_ or similar?
Thanks,
brew