I just started to write a C program converting some LaTeX into HTML code. The best way in my opinion is to use regular expressions, yet I cannot make this simple idea work with PCRE: Replace something like \term{abc}
by [pre]abc[/pre]
(\term
is a Latex command of my own). Right now here's the catch:
- How do I handle escaped curly braces (
\}
) in\term
? - How do I handle pairs like
{}
? - How do I make the regular expression so greedy that it consumes the first of many
\term
commands, but not all of them?
Well, many questions to figure it out. Hope somebody can help?
PS: I'm sorry if, in any case, I have overlooked an answer to a similar question...