void () { RegexFacade regex = RegexFacade.regex("мир"); byte[] stringBytes = "привет, мир, привет, мир".getBytes(StandardCharsets.UTF_8); Searcher searcher = regex.searcher(stringBytes); assertTrue(searcher.search()); MatchData matchData = searcher.getCurrentMatchData(); assertEquals(1, matchData.count()); assertEquals(new TextMateRange(8, 11), matchData.codePointRange(stringBytes)); assertEquals(11, searcher.getCurrentCharPosition()); assertTrue(searcher.search()); matchData = searcher.getCurrentMatchData(); assertEquals(1, matchData.count()); assertEquals(new TextMateRange(21, 24), matchData.codePointRange(stringBytes)); assertFalse(searcher.search()); assertEquals(-1, searcher.getCurrentCharPosition()); }