private static Pattern toRegex(String pattern) {
        StringBuilder ret = new StringBuilder();
        ret.append("^");
        for (int i = 0; i < pattern.length(); i++) {
            ret.append(toRegex(pattern.charAt(i)));
        }
        ret.append("$");
        return Pattern.compile(ret.toString());
    }
Converts the given string pattern to a usable regex pattern object.

@param pattern The string pattern to convert.
@return The corresponding regex pattern object.
messagebus/src/main/java/com/yahoo/messagebus/routing/ApplicationSpec.java