in reply to How to make substitute greedy like sed's substitute
Do yourself a favor and use a XML parser. The task at hand sounds perfect for XML::Rules, but XML::Twig would also work great.
Jenda Enoch was right! Enjoy the last years of Rome.