Commit a54b16e0 by 朱亚洁

bug处理

parent d0716392
...@@ -760,19 +760,23 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -760,19 +760,23 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
* @return * @return
*/ */
private List<String> getLinkList(String title, Boolean isNew) { private List<String> getLinkList(String title, Boolean isNew) {
//标题正则表达式 List<String> list = new ArrayList<>();
Pattern pa;
if (isNew) { if (isNew) {
title = title.replaceAll("&nbsp;"," "); String regex = "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
pa = Pattern.compile(UrlConstant.OWN_SHORT_URL + "[0-9A-Za-z]+\\s"); Matcher matcher = Pattern.compile(regex, Pattern.DOTALL).matcher(title);
} else { while (matcher.find()) {
pa = Pattern.compile("<link>.*?</link>"); String url = matcher.group();
if (url.startsWith(UrlConstant.OWN_SHORT_URL)) {
list.add(matcher.group());
} }
List<String> list = new ArrayList<>(); }
} else {
Pattern pa = Pattern.compile("<link>.*?</link>");
Matcher ma = pa.matcher(title); Matcher ma = pa.matcher(title);
while (ma.find()) { while (ma.find()) {
list.add(ma.group()); list.add(ma.group());
} }
}
return list; return list;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment