I am not too good with Regular Expressions in Javascript. Does anyone know an efficient way to capture the last portion of a URL???
I have the following URL:
<
There are built in methods for this:
window.location.pathname.split("/").pop()
This will get everything after the domain name (window.location.pathname), then split it by forward slashes (split("/")), then return the last item of the array returned by split(), (pop()).
window.location.pathname
split("/")
split()
pop()