Yeah, the gsub captures the last token delimited by slashes, which should be the same encoded or not. I may end up using your code for clarity regardless though. Many thanks for the review.