A_{n+1} prevents parseEquation working


I’m trying to check student answers for writing the recursive forms of arithmetic and geometric sequences. Student answers should look like a_{n+1} = a_{n}+12

I use

l1 = parseEquation(this.cellContent(1,2)).lhs
r1 = parseEquation(this.cellContent(1,2)).rhs
o1 = this.cellContent(1,2)

ans =
simpleFunction(l1,“a_n”).evaluateAt(-8.42) = simpleFunction(x+12,“x”).evaluateAt(-8.42) or
simpleFunction(r1,“a_n”).evaluateAt(-8.42) = simpleFunction(x+12,“x”).evaluateAt(-8.42) or
simpleFunction(o1,“a_n”).evaluateAt(-8.42) = simpleFunction(x+12,“x”).evaluateAt(-8.42) 1
otherwise 0
correct: ans = 1

Unfortunately, when a_{n+1} is part of the latex input, parseEquation stops working and so does pattern matching. It there another way to recognize the recursive part of the equation, or do I need to instruct students not to type a_{n+1}?