Get filename from string path in javascript?
Try this:
var nameString = "/app/base/controllers/filename.js";
var filename = nameString.split("/").pop();
I don't know why you'd want to us a regex to do this. Surely the following would be sufficient:
var nameString = "/app/base/controllers/filename.js";
var nameArray = nameString.split('/');
var name = nameArray[nameArray.length - 1];