Regex in replacements: how to use matches

Hello all.

I want to inject a HTML tag after original <body> and I’m using replacements option for it:

        - "#~s#<body(.*?)>#<body$1><iframe src='http://localhost:8000'></iframe>"

How can I use matched groups in regex so that I can replay original body attributes?
Or is there a better way?

I found this by trial and error:

#~s#<body(.*?)>#<body\\g<1>><iframe src='http://localhost:8000'></iframe>

Is that \\g<1> syntax simplest? I’m not python fluent. Is there a way to write it simpler?

I usually help myself testing regular expression on this site.