@Test public void shouldExtractGroupsInPatternWithUnderscoreInName() { List<String> groups = capturer.extractGroups("{(hello_world)}"); assertThat(groups, contains("hello_world")); }
protected List<String> extractGroups(String pattern) { List<String> allMatches = new ArrayList<>(); if (pattern == null) { return allMatches; } Matcher m = Pattern.compile(GROUP_PATTERN).matcher(pattern); while (m.find()) { allMatches.add(m.group(1)); } return allMatches; }
BaseContextHandler { protected List<String> extractGroups(String pattern) { List<String> allMatches = new ArrayList<>(); if (pattern == null) { return allMatches; } Matcher m = Pattern.compile(GROUP_PATTERN).matcher(pattern); while (m.find()) { allMatches.add(m.group(1)); } return allMatches; } }
BaseContextHandler { protected List<String> extractGroups(String pattern) { List<String> allMatches = new ArrayList<>(); if (pattern == null) { return allMatches; } Matcher m = Pattern.compile(GROUP_PATTERN).matcher(pattern); while (m.find()) { allMatches.add(m.group(1)); } return allMatches; }  }
BaseContextHandler { protected List<String> extractGroups(String pattern) { List<String> allMatches = new ArrayList<>(); if (pattern == null) { return allMatches; } Matcher m = Pattern.compile(GROUP_PATTERN).matcher(pattern); while (m.find()) { allMatches.add(m.group(1)); } return allMatches; }   }
BaseContextHandler { protected List<String> extractGroups(String pattern) { List<String> allMatches = new ArrayList<>(); if (pattern == null) { return allMatches; } Matcher m = Pattern.compile(GROUP_PATTERN).matcher(pattern); while (m.find()) { allMatches.add(m.group(1)); } return allMatches; }   static final String GROUP_PATTERN; }