@Test public void captures_start_and_end() { TreeRegexp tr = new TreeRegexp("^the step \"([^\"]*)\" has status \"([^\"]*)\"$"); Group g = tr.match("the step \"a pending step\" has status \"pending\""); assertEquals(10, g.getChildren().get(0).getStart()); assertEquals(24, g.getChildren().get(0).getEnd()); assertEquals(38, g.getChildren().get(1).getStart()); assertEquals(45, g.getChildren().get(1).getEnd()); }
Group match(CharSequence s) { final Matcher matcher = pattern.matcher(s); if (!matcher.matches()) return null; return groupBuilder.build(matcher, IntStream.rangeClosed(0, matcher.groupCount()).iterator()); }
TreeRegexp { Group match(CharSequence s) { final Matcher matcher = pattern.matcher(s); if (!matcher.matches()) return null; return groupBuilder.build(matcher, IntStream.rangeClosed(0, matcher.groupCount()).iterator()); } }
TreeRegexp { Group match(CharSequence s) { final Matcher matcher = pattern.matcher(s); if (!matcher.matches()) return null; return groupBuilder.build(matcher, IntStream.rangeClosed(0, matcher.groupCount()).iterator()); } TreeRegexp(String regexp);   TreeRegexp(Pattern pattern); }
TreeRegexp { Group match(CharSequence s) { final Matcher matcher = pattern.matcher(s); if (!matcher.matches()) return null; return groupBuilder.build(matcher, IntStream.rangeClosed(0, matcher.groupCount()).iterator()); } TreeRegexp(String regexp);   TreeRegexp(Pattern pattern); GroupBuilder getGroupBuilder(); }
TreeRegexp { Group match(CharSequence s) { final Matcher matcher = pattern.matcher(s); if (!matcher.matches()) return null; return groupBuilder.build(matcher, IntStream.rangeClosed(0, matcher.groupCount()).iterator()); } TreeRegexp(String regexp);   TreeRegexp(Pattern pattern); GroupBuilder getGroupBuilder();  }