Unfortunately I suck at regexp. If I have a path like so:
/long/path/to/file, I just need to extact file.
/long/path/to/file
file
If someone supplies
What about this?
> path <- "/long/path/to/file" > require(stringr) > str_extract(path, "[^/]*$") [1] "file"
If I understand correctly, you could use the basename function.
basename
f <- "/long/path/to/file" basename(f) # [1] "file"