日期:2014-05-20 浏览次数:20908 次
public class Test {
public static void find(String regex, String string){
regex = regex.replaceAll("\\*", ".*");
Matcher m = Pattern.compile(regex).matcher(string);
while(m.find()){
System.out.println(m.group());
}
}
public static void main(String[] args) {
String string = "abcdefghijklmnopqrstuvwxyz";
String regex = "*b";
find(regex, string);
}
}