Here’s a quick Javascript function that will parse the filename from a path using regex. It looks for any letter or digit, hyphen, or underscore followed by a dot (.) followed by a letters or numbers for the extension.
function getFileName(path) { return path.match(/[-_\w]+[.][\w]+$/i)[0]; }
The post Get a Filename from a Path in Javascript appeared first on RobVolk.com.