public static String toConfig(final LegacyFilterConfig config) {
        final StringBuilder sb = new StringBuilder();
        boolean first = true;
        final List<String> defaultConfig = config.get(null);
        if (defaultConfig != null && !defaultConfig.isEmpty() && defaultConfig.get(0) != null) {
            if (defaultConfig.get(0).isEmpty()) {
                sb.append(KEYVALUE_SEPARATOR);
            }
            for (String value : defaultConfig) {
                if (!first) {
                    sb.append(CONFIG_SEPARATOR);
                }
                first = false;
                sb.append(escape(value));
            }
        }
        for (Map.Entry<String, List<String>> entry : config.entrySet()) {
            if (entry.getKey() == null || entry.getValue() == null) {
                continue;
            }
            for (String value : entry.getValue()) {
                if (!first) {
                    sb.append(CONFIG_SEPARATOR);
                }
                first = false;
                sb.append(escape(entry.getKey()));
                sb.append(KEYVALUE_SEPARATOR);
                sb.append(escape(value));
            }
        }
        return sb.toString();
    }
Escapes all characters with a backslash (\) which could have a special meaning in context of expressions.
Those are: ()=:[]; and the backslash \ itself

@param raw string to escape
@return escaped string
main/src/main/java/cgeo/geocaching/utils/config/LegacyFilterConfigParser.java