@ SimonO101 has the most reliable IMO answer, but some other options:
Since regular expressions are greedy, you can take advantage of them
sub('.*/', '', path)
Also, you do not need []
around /
in strsplit
.
> tail(strsplit(path,"/")[[1]],1) [1] "fooXbar.xls"
source share