Add a: `s.replace(QRegExp("(\\$[^\\$]\\$)"), QString());` or something like that before the "return s" in order to remove any remaining macros that are not part of `repMap` from the input.