in reply to "Not containing something" in substitution

As far as I can see, there's no reason why the text between [xyz] and [/xyz] should not contain such a tag. Since the data is already structured XML (or HTML) like, you can do a straightforward replace of [xyz] -> <something bla="bla"> and [/xyz] -> </something>.

Unless I miss something... Just my 2 cents, -gjb-