I am trying to write a short script to change tex syntax into rst syntax because in some instances, it's easier to just write $some math$
instead of :math:`some math`
.
Now say I have a file that has multiple inline math occurences, e.g.
foo.rst:
Only $one$ inline math.
This $line$ has $some$ more $math$ then $the$ first one
So far, what I have working is the simple case where there is only one occurence (first line in example file), but sed
seems to match the last $
in the line, not the first after the first match. This is my result:
$ sed -E 's/\$(.+)\$/:math:`\1`/g' foo.rst
Only :math:`one` inline math.
This :math:`line$ has $some$ more $math$ then $others`
How do I need to change my sed command to match all $
pair-wise?