题解 | #字符串通配符#,可以的,又学到了
字符串通配符
http://www.nowcoder.com/practice/43072d50a6eb44d2a6c816a283b02036
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
while (in.hasNext()){
String regx = in.next();
String str = in.next();
regx = regx.toLowerCase();
str = str.toLowerCase();
regx = regx.replaceAll("\\*{2,}","\\*");
regx = regx.replaceAll("\\?","[0-9a-z]{1}");
regx = regx.replaceAll("\\*","[0-9a-z]{0,}");
boolean b = str.matches(regx);
System.out.println(b);
}
}
}

美团工作强度 2569人发布
