code: public static Pattern mappingToRegex(String mapping)
     {
        return Pattern.compile(mapping.replaceAll("\\.", "\\.")
                 .replaceAll("^\\*(.*)", "^(.*)$1\\$")
                 .replaceAll("(.*)\\*$", "^$1(.*)\\$"));
     }
docs: Convert a Servlet Mapping to a compiled {@link Pattern}