class SseUtil {

    public static List<String> convertToRegex(@Nullable String topicFilter) {
        List<String> filters = new ArrayList<>();

        if (topicFilter == null || topicFilter.isEmpty()) {
            filters.add(".*");
        } else {
            StringTokenizer tokenizer = new StringTokenizer(topicFilter, ",");
            while (tokenizer.hasMoreElements()) {
                String regex = tokenizer.nextToken().trim().replace("*", ".*") + ".*";
                filters.add(regex);
            }
        }

        return filters;
    }

}