Extracting a Numeric Value from a 1 variable latex string

Is it possible to extract a numeric value from the latex string from a student math input? For example, if the student inputs x+4=7, can I get the value 3 out of this?

In effect, I want the latex string solved if it is a 1 variable equation.

Alternatively, can I carry the entire latex string for the student input and put it into a row of a table connected to a graph. For example, if the x+4=7 was carried into a row of the graph, a vertical line will appear at x=3.

Are you sure this solution works for all sorts of equations? It seems from looking at it that it only works for a number +/- x (with a coefficient of 1) on one side and a number on the other.