I have the name of a file like this: name1.csv and I would like to extract two substrings of this string. One that stores the name1 in one variable
name1.csv
name1
Using regular expression, you can do this for example
regmatches(x='name1.csv',gregexpr('[.]','name1.csv'),invert=TRUE) [[1]] [1] "name1" "csv"