String (@NotNull String mask) { List<String> strings = StringUtil.split(mask, "\\"); StringBuilder pattern = new StringBuilder(); String separator = ""; for (String string : strings) { string = StringUtil.replace(string, ".", "\\."); for (Map.Entry<String, String> e : ourEscapeRules.entrySet()) { string = StringUtil.replace(string, e.getKey(), e.getValue()); } pattern.append(separator); separator = "\\\\"; pattern.append(string); } return pattern.toString(); }