in reply to shtml publisher
To make this correctly handle multiple SSI directives on a line, you're going to have to do a bit of work on one of your regexps.
Try to make it work. The debugging will be insightful.
Additionally, blindly doing s/\.shtml/.html/ may not be what you really want to do. But if it is, don't stop at the first one on the line.
You might want to take a look at my SSI conversion script. It'll give you some ideas on how to handle other directives.
In Section
Code Catacombs