On Jan 23, 2008, at 10:50 PM, Peter Münster wrote:
I've just seen, that it does not work for nested braces: \footnote{x{y}z}: ok \footnote{x{y{z}}}: not ok
The next one (normal regexp, not extended) has support for up to one level of nesting:
\\footnote{[^{}]*\([^{}]*{[^{}]*\([^{}]*{[^{}]*}[^{}]*\)*[^{}]*} [^{}]*\)*[^{}]*}
These examples seem to work: \footnote{x{y}z} \footnote{x{y{z}}} \footnote{x{y}z} \footnote{x{y{z}}x{y{z}}x{y}z} \footnote{x{y{z}}x{y{z}y{z}y}x{y}z}
Cheers, Peter
You could also use a nice scripting language like ... lua!! lua has support for "balanced strings," so no nesting trickery is needed, see http://www.lua.org/pil/20.2.html (scroll to the bottom of the page). Or you could try and nag Hans into giving a nice tutorial on the lua lpeg library at Bohinj! :-) All best Thomas