On 2021-02-11 2:04 pm, David Kastrup wrote:
Short of special-patterning the known exceptions...  a bit of a
nightmare.

Does the pattern matching need to be so particular about context? Consider a primitive approach:

  re.sub(r'\\note\s*#"([^"]+)"', r"\\note { \g<1> }", ...)

This matches the `\note #"..."` pattern, converting to `\note { ... }`.


-- Aaron Hill

Reply via email to