title: Regex to match LaTeX equations
body: <p>I am trying to configure the TeXWorks editor to use the same syntax coloring as TeXMaker. However, TexWorks uses regexes to specify what should be coloured. Unfortunately it doesn't have a default setting for math.</p>
  
  <p>I want to match everything between <code>$</code> and <code>$</code>,
  everything between <code>\[</code> and <code>\]</code>,
  everything between <code>\(</code> and <code>\)</code>,
  everything between <code>$$</code> and <code>$$</code>. The latter is not very necessary because it's rarely used in LaTeX documents.</p>
  
  <p>It can also be more than one regexes to match all cases.</p>
  
  <p>Of course <code>\$</code> is escaped so I don't want to match that, nor <code>\\[</code> etc.</p>
  
  <p>Then I also want to match everything between <code>\begin{equation}</code> and <code>\end{equation}</code>, but that is simple.</p>
  
  <p>'It cannot be done' is a possible answer.</p>