Here you can find the source of wildcardToRegex(CharSequence s)
public static String wildcardToRegex(CharSequence s)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by public class Main { public static String wildcardToRegex(CharSequence s) { StringBuilder sb = new StringBuilder(); int len = s.length(); for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '*': sb.append(".*"); break; case '?': sb.append("."); break; case '[': case ']': case '(': case ')': case '{': case '}': case '|': case '+': case '-': case '^': case '$': case '\\': case '.': sb.append("\\").append(ch); break; default: sb.append(ch);/*from www . jav a2 s. c om*/ break; } } return sb.toString(); } }