A nice site to test regex is regex101.com. Select ‘golang’ there in the left menu for the regex that Hugo uses.
There’s also a code generator there and Python support, so you might be able to transform your Python code there to Hugo’s format with a bit more ease. Good luck!