Need help parsing an expression

Hi! I am trying to have students factor a random rational expression (I’m limiting it to a binomial for the numerator and a binomial for the denominator with a common factor).
I would then like to be able to check the student 's factors (all four) with the correct factors.

Here is my attempt: Simplifying Rational Expressions trial • Activity Builder by Desmos Classroom

I am currently stuck with parsing the student’s factored function into its four factors. My eyes are crossed and I am now completely doubting what I am doing.

Slide 2 is my edit.
I used parsefraction, and checked that the factored form of the numerator evaluated at 2.5 was equal to the original numerator evalauated at 2.5 (den as well)
and then used a pattern check for either binXbin or x(bin) or (bin)^2..as long as coef is one (a=1).

Let me know if this works.

Thanks! This definitely works.
Here is what I have so far:

Hopefully, I will be able to include more flexibility with the functions, but I am perfectly good with it as it is now.

Thank you for your help and input.

I make slides like that all the time. Just for the heck of it, I made an addition (slide 2) that changes the variable. It’s just a list of latex variables that you can just add another letter to the list, with no other edits.(After changing ALL the x’s to ${v}) Use more x’s on the list if you want that to be the more prevalent variable.
The code that chooses the variable (two lines) is useful for other things as well. I use it all the time. For example, coefficient lists that skip zero.

https://teacher.desmos.com/activitybuilder/custom/6800e079c334826a13eb5ed5?utm_campaign=share&utm_content=activity

This is great. Thanks for the tip.I haven’t worked with lists/arrays (yet) but was definitely heading in that direction.
You’ve helped so much.