does someone know a way to split string using at a certain string but just if there is no space before? Maybe even using the strsplit function? Here is an example:
input_str = "For example. Production of something a Product.ProIts cool"
I want to split the string using the "Pro" in ".ProIts cool", but not the other "Pro" in Production or Product. There is not in any case a point before the Pro, but there should be always be a space if someone wrote something with "Pro...". I have also different separators. Here is my current code, which works fine if there is no duplicated separator in the text:
arr_seperators = c("String1", "Pro" , "Contra")
n = 3
output = rep(0,n)
for ( i in 1:n){
output[i] = strsplit(input_str, arr_seperators[i])[[1]][2]
for (j in 1:n){
output[i] = strsplit(output[i], arr_seperators[j])[[1]][1]
}
}
print(output)