I have stored a URL link in a vector as :
links <- "https://www.amazon.in/Glass-Milk-Bottle-Clear-Pieces/dp/B01J9SKYYU&sa=U&ved=0ahUKEwiGkd_x8P3ZAhUOSY8KHZUVBg0QFggmMAA&usg=AOvVaw1wAFHoDLiP94xbl9JJsp8E"
And I wanted to extract only one part of the above url: i.e. "https://www.amazon.in/Glass-Milk-Bottle-Clear-Pieces/dp/B01J9SKYYU"
What I am trying to do is in the below code but I could not do that..
library(stringr)
upattern <- "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
ExtractedURL <- str_extract(links[1], upattern)
Where I did make the mistake?