// Regex
var result = /[^/]*$/.exec("foo/bar/test.html")[0];
// Using lastIndexOf and substring
var str = "foo/bar/test.html";
var n = str.lastIndexOf('/');
var result = str.substring(n + 1);
// Using Array#split
var parts = "foo/bar/test.html".split("/");
var result = parts[parts.length - 1]; // Or parts.pop();