一段html代码:
<a class="context_link" href="/thuc-don/41-Thit-vit-ram-sa-gung.html">
<img src="http://monngonmoingay.com/uploads/monan/201205170430310000000_thit" +
"-vit-ram-sa-gung-48aq570.png" alt="Thịt vịt ram sả gừng " />
所以我使用正则表达式从代码中获取链接:
String pat = "<a\\s+class=\"context_link\"\\s+href=\"(.+)\"";
Pattern pattern = Pattern.compile(pat,Pattern.DOTALL | Pattern.UNIX_LINES);
Matcher math = pattern.matcher(source);
while(math.find()){Log.i("Value",math.group(1));}
当我检查是否匹配时,结果总是错误的。
谁能帮我修复错误呢?