Hello @peterjones and All,
In your last example, relative to INCREMENT THE COUNTER PER-GROUP INSTEAD OF PER-MATCH, I suppose that we could simplify the final regex from :
editor.rereplace(r'(?s)^{\h*$.*?^},?\h*$', replace_group)to :
editor.rereplace(r'(?s)^{.+?^},?\h*$', replace_group)BR
guy038