62,614
社区成员
发帖
与我相关
我的任务
分享
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
String A = "张江路";
String B = "碧波大道";
Pattern p = Pattern.compile(A + "\\d.*" + B);
Matcher m = p.matcher("张江路12p碧波大道295");
while(m.find()){
System.out.println("false");
}
}
}
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
String A = "张江路";
String B = "碧波大道";
Pattern p = Pattern.compile(A + "\\d.*" + B);
Matcher m = p.matcher("张江路12p碧波大道295");
while(m.find()){
System.out.println("false");
}
}
}
String str = "aaaaa222bbbb";
String A = "aaa";
String B = "bbb";
Pattern p = Pattern.compile((A + "*?" + B));
Matcher m = p.matcher(str);
while(m.find()){
String temp = m.group();
System.out.println(temp + "\t" + temp.matches(A +"[^\\d].*?" + B));
}