Regex pattern not working properly on matcher
<p>I have a string like this:</p>

<pre><code>ben[0]='zc5u5';
icb[0]='M';
bild[0]='b1_413134.jpg';
ort[0]='Köln';kmm[0]=0.00074758603074103;alt[0]='18';
jti[0]=413134;
upd[0]='u41313486729.js';
jon[0]=0;
jco[0]=0;
jch[0]=0;
ben[1]='Oukg5';
icb[1]='M';
bild[1]='mannse.jpg';
jti[1]=412425;
upd[1]='u41242570092.js';
jon[1]=0;
jco[1]=0;
jch[1]=0;
ben[2]='Tester356';
icb[2]='M';
bild[2]='b1_247967.jpg';
</code></pre>

<p>I want to get the names from<code>ben[]</code>, for example the first one would be <code>zc5u5</code>.</p>

<p>I do currently have this code:</p>

<pre><code>            Pattern pattern = Pattern.compile("(ben\\[\\d+\\]=').+?'");
            Matcher matcher = pattern.matcher(string);

            LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;();

            // Loop through and find all matches and store them into the List
            while(matcher.find()) {
                list.add(matcher.group());
            }
</code></pre>

<p>Unfortunately the pattern does match the whole line, instead of just the value, e.g. <code>zc5u5</code>. What am I doing wrong?</p>