@Test public void uses_loaded_pattern_compiler_service() { String regexp = "[0-9]"; TreeRegexp tr = new TreeRegexp(regexp); assertNull(tr.match("1a")); PatternCompilerProvider.service = (re, flags) -> Pattern.compile(re + "[a-z]", flags); tr = new TreeRegexp(regexp); assertEquals("1a", tr.match("1a").getValue()); PatternCompilerProvider.service = null; }
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();  }