title: perlre match capturing group multiple times on the same line
body: <p>Given the following line;</p>
  <p><code>&lt;tag id='1'&gt;&lt;![CDATA[this is a string of text]]&gt;&lt;tag id='2'&gt;&lt;![CDATA[this is another string of text]]&gt;&lt;tag id='3'&gt;&lt;![CDATA[this is the last string of text]]&gt;</code></p>
  <p>I'm trying to match the text string inside the CDATA square brackets in a way that returns every match without having to split the line first. I can accomplish this by splitting the line (see below) but am trying to better understand perl regex matching and whether I can accomplish the same using regex.</p>
  <pre><code>my $string = qq(&lt;tag id='1'&gt;&lt;![CDATA[this is a string of text]]&gt;&lt;tag id='2'&gt;&lt;![CDATA[this is another string of text]]&gt;&lt;tag id='3'&gt;&lt;![CDATA[this is the last string of text]]&gt;)
  my @splitline = split(/\&lt;/, $string);
  foreach(@splitline){
     if ($_ =~ /\!\[CDATA\[(.*?)\]\]/){
        print &quot;$1\n&quot;;
     }
  }
  </code></pre>
  <p>The result of above is</p>
  <blockquote>
  <p>this is a string of text</p>
  <p>this is another string of text</p>
  <p>this is the last string of text</p>
  </blockquote>
  <p>If I try this, it only returns the first match.</p>
  <pre><code>my $string = qq(&lt;tag id='1'&gt;&lt;![CDATA[this is a string of text]]&gt;&lt;tag id='2'&gt;&lt;![CDATA[this is another string of text]]&gt;&lt;tag id='3'&gt;&lt;![CDATA[this is the last string of text]]&gt;)
  if ($string =~ /\!\[CDATA\[(.*?)\]\]/){
     print &quot;$1\n&quot;;
  }
  </code></pre>
  <p>changing my regex to the following returns no data</p>
  <pre><code>$string =~ /\!\[CDATA\[(.*?)+\]\]/g
  </code></pre>