extract first element before a character stringr
library(stringr)
df1 <- read.table(text = "ABC|DEF|GHI, ABCD|EFG|HIJK, ABCDE|FGHI|JKL,
DEF|GHIJ|KLM, GHI|JKLM|NO|PQRS, BCDE|FGHI|JKL")
#extract 1st word before |
word(df1$V1,1,sep = "\\|")