but in the code belowQuote:
Capturing groups are numbered by counting their opening parentheses from left to right.
result variable contains "::11.txt::" (second group), not "::words.txt::" i expect.Code:
final String regex = ".*(::.*::).*";
Pattern pattern = Pattern.compile(regex);
String query = "::words.txt:: asdf\"::11.txt::\"";
Matcher matcher = pattern.matcher(query);
String result = matcher.group(1);
What do I wrong?
How to capture first inclusion?