提取 <a> 标记 属性 href 中的值
------解决方案--------------------
up
------解决方案--------------------
用DOM行不?
getElementByTagName( "a ").getAttribute( "href ");
------解决方案--------------------
//提取href
String a1= " <a target=\ "_blank\ " href=\ "http://www.cnta.com/\ " ";
String r= "href=\ "([^\ "]+) ";
Pattern s=Pattern.compile(r);
Matcher m1=s.matcher(a1);
if(m1.find())
System.out.println( "href 为 "+m1.group(1));
------解决方案--------------------
public static void main(String[] args) {
String a1 = " <a href=\ "http://www.goodlrc.com/html/240.htm\ "> ";
Pattern s = Pattern.compile( " <a\\s+href=\ "(.*?)\ "> ");
Matcher m1 = s.matcher(a1);
if (m1.find())
System.out.println( "href 为 " + m1.group(1));
}