Good point. You can also handle the change in content length by using a custom HTTP profile with response chunking set to rechunk:
http://devcentral.f5.com/wiki/default.aspx/iRules/STREAM__expression.html
When performing stream replacements where the original and replacement strings are different lengths, you must force BIG-IP to discard the server's Content-Length header and chunk the data before sending the response onto the client. This can be done by applying a custom HTTP profile to the virtual server with Response Chunking set to "Rechunk". See AskF5 SOL6422 for details.
Aaron