Urgent ! parse with parentheses

How can I parse the following [-3 - (-5) ] to get the second numenator -5 or 5 in case [ -3 - (+5) ]

thanks
Itzik

This should work, but not with square brackets, only parentheses. Is that ok?

thanks, however my idea is to build activity on converting subtraction to sum. I’ve added my try. of course the first column is the exercise givent and rest is student’s respond, which I want to validate. first row is an example.
convert subtraction to sum

Oh, I didn’t realize you wanted to have them actually type +5. I added another screen here that I think does what you want, though I’m not sure how to force there to be parentheses. So in row 2, they could enter 3 + (+5) or 3 + + 5 and both would work. I changed the main pattern to look for expression instead of number, since that will preserve the + sign.

thanks a million, very nice approach, which I’ll keep. For this activity I’ll add an hidden tabAnswers with the correct input to simplify the validation to just compare.

thanks again
itzik

1 Like

No problem. I also just added in a 4th screen because I thought of a way to make the code a bit more efficient to write.