1
This commit is contained in:
@@ -191,7 +191,7 @@ public class WxMessageConsumer {
|
||||
//}
|
||||
private static String getUrlStr(String msg) {
|
||||
//String urlPattern = "https?://[\\w-\\.]+(\\.[a-z]{2,})?(/[\\w-./?%&=]*)?"
|
||||
String urlPattern = "https?://[^\\s]+?\\.(html|htm)(\\?[^\\s]*?)?";
|
||||
String urlPattern = "https?://\\S+?\\.(html|htm)(\\?\\S*?)?";
|
||||
Pattern pattern = Pattern.compile(urlPattern);
|
||||
Matcher matcher = pattern.matcher(msg);
|
||||
|
||||
@@ -207,7 +207,7 @@ public class WxMessageConsumer {
|
||||
// 移除最后一个字符(即问号)
|
||||
finallyUrl = finallyUrl.substring(0, finallyUrl.length() - 1);
|
||||
}
|
||||
if (finallyUrl.contains("item.m.jd.com/product")) {
|
||||
if (finallyUrl != null && finallyUrl.contains("item.m.jd.com/product")) {
|
||||
finallyUrl = finallyUrl.replace("item.m.jd.com/product", "item.jd.com");
|
||||
}
|
||||
return finallyUrl;
|
||||
|
||||
Reference in New Issue
Block a user