Hello @peterjones, @DJSpirosG and All,
I suppose that the regex, in the Python script, is r'^(\\[#)(\d+)(\\])' and NOT r'^(\[#)(\d+)(\])' !!
If so, Peter, I can edit your post and make the corrections. Just tell me !
Remark : To explicitly write the literal strings \\[ and \\], in our forum, you need to write them as \\\[ and \\\]
Note also that, unfortunately, the Preview panel does not show the right layout :-(( Things are OK when you click on the Submit button, only !
BR
guy038
P.S. :
To write the text, of the Remark line, just above, I needed to write :
First, 2 consecutive \ before each square bracket !
Second, 3 consecutive \ before each square bracket !