E.g:
带有我想要的特殊网址的给定文字:
17.http://www.kt8.com.cn/images/skin/small/url.gifhttp://u.115.com/file/t16785f328# XTM.DVD-HALFCD2.Touch.1985.EP017.mkv
18.http://www.kt8.com.cn/images/skin/small/url.gifhttp://u.115.com/file/t1c64a6022# XTM.DVD-HALFCD2.Touch.1985.EP018.mkv
19.http://www.kt8.com.cn/images/skin/small/url.gifhttp://u.115.com/file/t1c1a4047b#
我想提取网址:
http://u.115.com/file/t16785f328#
这些URL地址模式是:
http://u.115.com/file/[fileParameterHere]#
所以,我需要一种方法来找出我想要的URL
地址。
任何建议都会很棒。
非常感谢!
答案 0 :(得分:1)
正则表达式可能是最好的方式:
var r = new RegExp("^http://u.115.com/file/([^#]+)#");
var x = null;
if(x = r.exec("http://u.115.com/file/t16785f328#")){
// do something with x
// x[1] contains "t16785f328"
}