I've recently been exploring the functionalities of MathJax, a Javascript library that enables the use of LaTex and similar mathematical markup languages within HTML. However, when attempting to incorporate it into my Javascript code, I encountered some challenges with regular expressions. Below is the snippet of code that I'm working with:
function sendTex()
{
var latexStuff = $("#texField").val();
var latexString = "When $a \ne 0$, there are two solutions to \*(ax^2 + bx + c = 0\*) and they are
$$x = {-b \pm \qrt{b^2-4ac} \over 2a}.$$";
$("#texVersion").append(latexString);
}