I have a url like http://www.example.com/blah/th.html
I need a javascript function to give me the \'th\' value from that.
All my urls have the same format (2
Use the match function.
function GetFilename(url) { if (url) { var m = url.toString().match(/.*\/(.+?)\./); if (m && m.length > 1) { return m[1]; } } return ""; }