I\'m trying to perform the following action on a string :
\"/\"
var result = /\/([^\/]*)$/.exec(location)[1]; //"remove-everything-before-the-last-occurrence-of-a-character#10767835"
Note: location here is the window.location, not your var location.
location
window.location
var location