Make replace pattern an evalable expression so that you can use $1 in replacement pattern with ProxyHTMLRewrite. Thanks to Roberto Majadas for the report.