Regex may have worked in this instance, but regex is generally NOT the best means of modifying XML.
XML is not regular. You should use XML tools to parse and manipulate XML data, or you will likely run into problems at some point.
Transforming the XML using an XSLT identity transform with a template for the particular "item1" element is one example that would be a more safe, robust solution:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="item1[item2/item1]" >
<!--Replace this literal element "NEW_ITEM_ELEMENT" with whatever name you need to change "item1" elements to: -->
<NEW_ITEM_ELEMENT>
<xsl:apply-templates />
</NEW_ITEM_ELEMENT>
</xsl:template>
</xsl:stylesheet>