Regular expression takes bounds into group
<p>I want to group some characters between special symbol bounds, but this bounds are involved into group. It is not connected with greedy and reluctant quantifier. </p>

<pre><code>String str1 = "#162xd14a#";
Matcher matcher = Pattern.compile("#(.*?)#").matcher(str1);
if (matcher.matches()) {
    for (int i = 0; i &lt; matcher.groupCount(); i++) {
        System.out.println(matcher.group(i));
    }
}
</code></pre>

<p>Result:</p>

<pre><code>#162xd14a#
</code></pre>

<p>But i expected:</p>

<pre><code>162xd14a
</code></pre>