Extract Vertex from LaTeX Input

Hi, I’m making an activity on vertex form of quadratic functions, and I was wondering if there’s a way to extract the vertex from a LaTeX string in vertex form. I’ve created this sample to show what I’m trying to do. If you put in the correct equation, it works how I want it to work, but you’ll see the problem if you put in an incorrect function.

I suspect patterns might do it, but that might be making it overly complicated.

Some calculus gets you there. Looked at patterns, but yeah complex.

Brilliant! That’ll work great. Thank you so much!