void () { RegexFacade regex = RegexFacade.regex("мир"); //noinspection NonAsciiCharacters String string = "\uD83D\uDEA7\uD83D\uDEA7\uD83D\uDEA7 привет, мир!"; StringWithId stringWithId = new StringWithId(string); MatchData match = regex.match(stringWithId, null); TextMateRange range = match.charRange(string, stringWithId.bytes); assertEquals("мир", string.substring(range.start, range.end)); }