apologies but am completely unaware of regex matching. therefore wanted to ask if someone can guide for creating a regex for following line (language C#)
$ ... $
<- anything that is within a $ .. $
and also for the following
$$ ... $$
<- anything that is within a $$ .. $$
the expressions may be as follows:
$ \[a\] + \[b\] + 23 $
to explain the requirement further, we are using MathJax and the input for mathjax is being taken from a rich textbox control (jqte).
but sometimes jqte injects its own html which does not render inside MathJax .
so the idea was to sanitize any input that is inside a MathJax expression and remove any HTML so that it can render properly.
Note: The [a] [b] etc are other variables that are assigned random values at runtime .
any help appreciated
Which regex engine are you using?
I have found some working examples but you need to test them on your own:
\$(.*?)\$
Or for the second one
\$\$(.*?)\$\$
You can use both at the same time with the | Operator (Note that this will create three matches with one non-empty group each)