I am looking to extract a string from a URL. Here is an example to illustrate what I am looking for.
Input URL: http://www.nba.com/bulls/stats/ Output : bulls
In other words, I want to be able to extract the string between the second last and last "/" in the url. I know that I can split by "/" and extract the second last term, but am looking for a cleaner regex solution.
Any ideas?
head(tail(unlist(strsplit(URL, "/")), 2), 1)