用java正则表达式怎么求出
http://community.csdn.net/Expert/PostNew.asp
中的PostNew.asp??
http://community.csdn.net/Expert/PostNew.asp
中的PostNew.asp??
解决方案 »
- JSP 拒绝编译 POI 类!为什么会有 Java Application 可以编译、而 JSP 却拒绝进行编译的类?
- JAVA问题
- 小程序急需
- 帮我看看哪出错了?
- 我用以下方法用JB9生成可执行文件的时候,为什么取不到主类?
- 菜鸟提问 关于javac
- ★★★★一个极其基础的问题:关于方法的返回值,在线等待……★★★★
- 如何利用socket传文件(不同格式的)?高分求救!!---在线等待
- [帮助]我把resin加到windows的服务里,但是启动不了!!
- 其实不是我打击大家,那个scjp一点用处都没有
- jbuilder2007 运行程序时显示the selection did not contain anything that can be run on a server
- 请问,如何做一个游离后可以改变大小的JToolbar
public static String getHref(String href){
Pattern s=Pattern.compile("http://.*/(.*)\\?");
Matcher m=s.matcher(href);
if(m.find())
return m.group(1);
else
return null;
}
如果url没有问号
就换为这个
Pattern s=Pattern.compile("http://.*/(.*)$");
String str ="http://community.csdn.net/Expert/PostNew.asp";
int i = str.lastIndexOf('/');
if (i > 0 && i < str.length() - 1) {
System.out.println(str.substring(i+1).toLowerCase());
}