Note that there are some explanatory texts on larger screens.

plurals
  1. POregex to replace '\\' by <br> but only outside some tags
    primarykey
    data
    text
    <p>I am new to regex and have been struggling for a while on this one: I want to transform LaTeX files to HTML. </p> <p>I use mathjax to render equations and some javascript replace functions to convert the tags. I have nearly finished, but I still have an issue with the line breaks: I need to transform <code>\\</code> to <code>&lt;br&gt;</code>, but <strong>only</strong> outside the tags <code>\begin{array}</code> and <code>\end{array}</code>.</p> <p>Example: in this portion, only the <code>\\</code> before <code>Montrer l'equivalence</code> should be replaced.</p> <pre><code>$M=\left( \begin{array}{c|c} A &amp;B \\ \hline C &amp;D \\ \end{array} \right)$ $in$ $\mathcal{M}_{n}(\mathbb{K})$ avec $A$ $\in$ $\mathcal{M}_{r}(\mathbb{K})$ inversible.\\ Montrer l'equivalence: \[ \Bigl( rg(A) = rg(M) \Bigr) \Leftrightarrow \Bigl( D = CA^{-1}B \Bigr) \] \begin{enumerate} \item Calculer $detB$ en fontion de $A$. \item En déduire que $detB \geqslant 0$. \end{enumerate} $M= \left( \begin{array}{c|c} A &amp;B \\ \hline C &amp;D \\ \end{array} \right)$ </code></pre> <p>How can I do this with regex ?</p> <p>EDIT: I have found <a href="http://regexpal.com/?flags=g&amp;regex=&amp;input=Soit%20%0A%24M%3D%0A%5Cleft%28%0A%5Cbegin%7Barray%7D%7Bc%7Cc%7D%0AA%20%26B%20%5C%5C%20%5Chline%0AC%20%26D%20%5C%5C%20%0A%5Cend%7Barray%7D%0A%5Cright%29%24%0A%0A%24in%24%20%24%5Cmathcal%7BM%7D_%7Bn%7D%28%5Cmathbb%7BK%7D%29%24%20avec%20%24A%24%20%24%5Cin%24%20%24%5Cmathcal%7BM%7D_%7Br%7D%28%5Cmathbb%7BK%7D%29%24%20inversible.%5C%5C%20Montrer%20l%27equivalence%3A%0A%5C%5B%0A%5CBigl%28%20rg%28A%29%20%3D%20rg%28M%29%20%20%5CBigr%29%20%5CLeftrightarrow%20%5CBigl%28%20D%20%3D%20CA%5E%7B-1%7DB%20%5CBigr%29%0A%5C%5D%0A%0A%0A%5Cbegin%7Benumerate%7D%20%0A%5Citem%20Calculer%20%24detB%24%20en%20fontion%20de%20%24A%24.%20%0A%5Citem%20En%20d%C3%A9duire%20que%20%24detB%20%5Cgeqslant%200%24.%0A%5Cend%7Benumerate%7D%0A%0A%24M%3D%0A%5Cleft%28%0A%5Cbegin%7Barray%7D%7Bc%7Cc%7D%0AA%20%26B%20%5C%5C%20%5Chline%0AC%20%26D%20%5C%5C%20%0A%5Cend%7Barray%7D%0A%5Cright%29%24" rel="nofollow">here</a> a handy regex tester...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload