Java Stringparsing with Regexp
I try to parse a String with a Regexp to get parameters out of it.
As an example:
<pre>
String: "TestStringpart1 with second test part2"
Result should be: String[] {"part1", "part2"}
Regexp: "TestString(.*?) with second test (.*?)"
</pre>
My Testcode was:
<pre>
String regexp = "TestString(.*?) with second test (.*?)";
String res = "TestStringpart1 with second test part2";

Pattern pattern = Pattern.compile(regexp);
Matcher matcher = pattern.matcher(res);
int i = 0;
while(matcher.find()) {
    i++;
    System.out.println(matcher.group(i));
}
</pre>

But it only outputs the "part1"
Could someone give me hint?

Thanks
Java Stringparsing with Regexp
===

I try to parse a String with a Regexp to get parameters out of it.
As an example:
<pre>
String: "TestStringpart1 with second test part2"
Result should be: String[] {"part1", "part2"}
Regexp: "TestString(.*?) with second test (.*?)"
</pre>
My Testcode was:
<pre>
String regexp = "TestString(.*?) with second test (.*?)";
String res = "TestStringpart1 with second test part2";

Pattern pattern = Pattern.compile(regexp);
Matcher matcher = pattern.matcher(res);
int i = 0;
while(matcher.find()) {
    i++;
    System.out.println(matcher.group(i));
}
</pre>

But it only outputs the "part1"
Could someone give me hint?

Thanks