regex to parse xml string
<p>I have a pom.xml file which I convert into string and trying to parse the dependencies it. For example </p>

<pre><code>&lt;dependencies&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  &lt;/dependency&gt;

  &lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-log4j2&lt;/artifactId&gt;
  &lt;/dependency&gt;    
&lt;/dependencies&gt;
</code></pre>

<p>I am trying to get the content between the <code>dependency</code> tag using the pattern</p>

<pre><code>({&lt;}dependency{&gt;}.*?{&lt;/}dependency{&gt;})
</code></pre>

<p>My goal is to get all the text like. </p>

<pre><code>&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;  
</code></pre>

<p>What is the correct pattern to do this ?</p>