62,630
社区成员
发帖
与我相关
我的任务
分享
smb://192.168.0.2/或者smb://username:password@192.168.0.2/的后面还有字符串呢,且以“/”结尾,如:smb://192.168.0.2/hello/或者smb://username:password@192.168.0.2/hello/
String ip = "([1-9]|[1-9]\\d|1\\d{2}|2[0-1]\\d|22[0-3])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}"
Pattern pattern = Pattern.compile("^(smb://)(\\w+:\\w+@)?((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)/$");
String t1 = "smb://192.168.0.2/";
String t2 = "smb://username:password@192.168.0.2/";
String reg = "^smb://((.*?:)(.*?@))?192.168.0.2/$";
if(t2.matches(reg)){
System.out.println("true");
}else if(t2.matches(reg)){
System.out.println("true");
}
String t2 = "smb://username:password@192.168.0.2/";
String reg = "smb://((.*?:)(.*?@))?192.168.0.2/$";
if(t2.matches(reg)){
System.out.println("true");
}else if(t2.matches(reg)){
System.out.println("true");
}
Pattern pattern = Pattern.compile("^(smb://)(\\w+:\\w+@)?(\\d{0,3}\\.){3}(\\w{0,3})/$");
Pattern p = Pattern
.compile("^(smb://)(\\w+:\\w+@)?((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])(/\\w+)*/");