[LON-CAPA-users] regular expression

H. K. Ng lon-capa-users@mail.lon-capa.org
Tue, 16 Aug 2005 10:41:41 -0400


At 10:21 AM 8/16/2005, you wrote:
>Why not use formula response instead of string?

formula response accepts answer such as

2/(4*x) whereas it should be

1/(2*x)

i.e., any multiple works. The algebra solution requires the student to 
reduce to the lowest denominator.



>On Aug 16, 2005, at 8:48 AM, H. K. Ng wrote:
>
>>Hi,
>>
>>Is there a way to construct the following regular expression? I
>>want the students to enter number1/(number2 * x) where number1 and
>>number2 are known integers. However, number2 can be 1, so that
>>means they can enter as number1/x and also, number1/(x) or number1/ 
>>(1*x). Question: For the last 2 answers, what I like to check is,
>>if they type the left parenthesis '(' then they need to enter the
>>right parenthesis ')'. I look in the Mastering Regular Expressions
>>book but could not find any info on how to check for an character.
>>
>>Thanks,
>>-hk
>>
>>_______________________________________________
>>LON-CAPA-users mailing list
>>LON-CAPA-users@mail.lon-capa.org
>>http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>
>_______________________________________________
>LON-CAPA-users mailing list
>LON-CAPA-users@mail.lon-capa.org
>http://mail.lon-capa.org/mailman/listinfo/lon-capa-users