<a href="http://www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天" target=_blank>LRC歌词来自:http://www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天</a>正则表达式为:"(?<=<a href=\").*?(?=\"\\s*>LRC歌词</a>)"
哪里错了?
哪里错了?
解决方案 »
- JRE的作用是什么
- java.io.EOFException
- Applet和JApplet小问题???????
- java中的FilenameFilter借口是怎么实现的
- 不知道是不是该脸红的问题。
- 真心请教问题(有关多维数组的初始化问题)
- 中文字符用pringln()输出后,是乱码怎么办??
- sqlserver2000的jdbc连接问题!!!
- 在java中怎样得到将要插入mysql的自动增加id
- I/O故障java.net.ConnectException: Connection refused: connect
- 请问JAVA的Callback和CallbackHandler怎么用
- 这程序怎么了?为什么显示不出来
就是没有match到!
然后在提取连接!下载歌词!
import java.util.regex.Pattern;public class Test
{
public static void main(String[] args)
{
String s="<a href=\"http://www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天\" target=_blank>LRC歌词来自:http://www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天 </a>";
String regex="LRC歌词来自:http://.*?</a>";
Matcher mt=Pattern.compile(regex).matcher(s);
while(mt.find())
{
String LRCurl=mt.group().replaceAll("LRC歌词来自:|</a>","");
System.out.println("您需要的网址为:"+LRCurl);
}
}
}
欢迎光临我的博客 http://blog.csdn.net/zhuche110/ 上面有很多介绍正则表达式的源代码。
String testreg =
"<a href=\"http://"
+"www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天\""
+"target=_blank>LRC歌词来自"
+"http://www.92mp3.com/lrc/lrc.asp?ac=down&id=17656&gq=晴天 </a>";
String matchreg ="(?s)(?:.*?LRC歌词来自)(.*?)</a>" ;
Pattern matchsip = Pattern.compile(matchreg);
Matcher mp = matchsip.matcher(testreg);
while(mp.find()){
System.out.println(mp.group(1));
}
你可以在我的csdn博客查看http://blog.csdn.net/zhuche110/archive/2008/04/01/2242314.aspx。