void () { RegexFacade regex = RegexFacade.regex("([0-9]+):([0-9]+)"); byte[] stringBytes = "12:00pm 13:00pm".getBytes(StandardCharsets.UTF_8); Searcher searcher = regex.searcher(stringBytes); assertTrue(searcher.search()); MatchData matchData = searcher.getCurrentMatchData(); assertEquals(3, matchData.count()); assertEquals(new TextMateRange(0, 5), matchData.codePointRange(stringBytes)); assertEquals(new TextMateRange(0, 2), matchData.codePointRange(stringBytes, 1)); assertEquals(new TextMateRange(3, 5), matchData.codePointRange(stringBytes, 2)); assertTrue(searcher.search()); matchData = searcher.getCurrentMatchData(); assertEquals(3, matchData.count()); assertEquals(new TextMateRange(8, 13), matchData.codePointRange(stringBytes)); assertEquals(new TextMateRange(8, 10), matchData.codePointRange(stringBytes, 1)); assertEquals(new TextMateRange(11, 13), matchData.codePointRange(stringBytes, 2)); assertFalse(searcher.search()); assertEquals(-1, searcher.getCurrentCharPosition()); }