How to extract special URL address from given text in JQuery1?
E.g:
The given text with special URL which I want:
17.http://www.kt8.com.cn/images/skin/small/url.gifhttp://u.115.com/file/t1678开发者_运维百科5f328# 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#
And I want to extract the URL:
http://u.115.com/file/t16785f328#
And these kind of URL address pattern is:
http://u.115.com/file/[fileParameterHere]#
So,I need a way to find out the URL
address I want.
Any suggestions will be great.
Thank you very much!
Regex is probably the best way:
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"
}
精彩评论