[LON-CAPA-users] regular expression

H. K. Ng lon-capa-users@mail.lon-capa.org
Tue, 16 Aug 2005 08:48:40 -0400


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