62,623
社区成员
发帖
与我相关
我的任务
分享
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) throws Exception {
String html = " <a href=/x_8c514596> 北京消息 </a> </li> <li> <a href=/x_878fc781> 达人";
Pattern expression = Pattern.compile("x_\\w+");
Matcher fitrate = expression.matcher(html);
String allLink = "";
while (fitrate.find()) {
allLink = allLink + fitrate.group() + " - ";
}
System.out.println(allLink);
}
}