I'm wanting to remove any filenames from a url path (which doesn't contain the domain) in javascript.
The path would look like this:
/something/myfile.html?d=var
or
/something/myfile.html
and this is the desired output:
/something/
Sometimes urls get passed in like this:
/something/else
I don't want 'else' to be stripped out. In other words a regex that simply strips everything after the last slash would not work in my case.
EDIT: To clarify, I consider a filename anything with a . after a forward slash as seen above.