Read characters with grep

I think you want to do something like this

string <- "101/Testler Export/somthing/shomething else.txt"
strsplit(string, "/")[[1]][1:2]
#> [1] "101"            "Testler Export"

Created on 2019-02-09 by the reprex package (v0.2.1)

For future posts please ask your questions with a REPRoducible EXample (reprex). A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

2 Likes