Ref T9790. This mangles pygmentize output so it does <span style="..."> instead of <span class="...">.
It doesn't use a regular expression, although it probably could.
I believe this is safe for all inputs, but it doesn't really matter: we'll only feed it safe inputs anyway, and it's only going to be used for email which we can't really do anything unsafe in.