`${arr}`.match(/\b\w{5}\b/g) || []
// или
arr.reduce((acc, n) => (n.length ^ '0b101' || acc.push(n), acc), [])
// или
arr.filter(n => n[4] && !n[-~4])
// или
arr.filter(RegExp.prototype.test.bind(/^.....$/))
// или
arr.reduce((acc, n) => ((acc[n.search('$')] ??= []).push(n), acc), {})[5] ?? []
// или
(function xxx(arr, i = 0) {
return arr.hasOwnProperty(i)
? [].concat(5 - [].push(...arr[i]) ? [] : arr[i], xxx(arr, i + 1))
: [];
})(arr)
import org.springframework.web.util.UriUtils;
class Main {
public static void main(String[] args) {
var path = "announce/Театр-Габима-Дело-всей-жизни";
var pathEncoded = UriUtils.encodePath(path, "UTF-8");
System.out.println("https://afisha.orbita.co.il" + pathEncoded);
// https://afisha.orbita.co.ilannounce/%D0%A2%D0%B5%D0%B0%D1%82%D1%80-%D0%93%D0%B0%D0%B1%D0%B8%D0%BC%D0%B0-%D0%94%D0%B5%D0%BB%D0%BE-%D0%B2%D1%81%D0%B5%D0%B9-%D0%B6%D0%B8%D0%B7%D0%BD%D0%B8
}
}