Commit 6fffe3d7 by 高鹏

Merge branch 'zyj-1001413' into 'master'

bug处理

See merge request rays/pcloud-book!174
parents ebe91cd5 a54b16e0
...@@ -760,18 +760,22 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -760,18 +760,22 @@ 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);
while (matcher.find()) {
String url = matcher.group();
if (url.startsWith(UrlConstant.OWN_SHORT_URL)) {
list.add(matcher.group());
}
}
} else { } else {
pa = Pattern.compile("<link>.*?</link>"); Pattern pa = Pattern.compile("<link>.*?</link>");
} Matcher ma = pa.matcher(title);
List<String> list = new ArrayList<>(); while (ma.find()) {
Matcher ma = pa.matcher(title); list.add(ma.group());
while (ma.find()) { }
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