In order to be able to process I\'d like to replace the first occurrence of a : in a string (which is my marker, that a speech begins).
text &l
You can also use str_replace from stringr package.
text1 <- c("ABC:DEF:", "SDF", "::ASW")
library(stringr)
str_replace(text1, ":", "|")
# [1] "ABC|DEF:" "SDF" "|:ASW"
This replaces the first occurence of : with |.
We can use sub as it matches only the first occurrence of pattern : and then we replace that with |.
sub(':', '|', text)