I have this pattern that I want to use to split a vector: "([^ ])(,)([^ ])". But the vector should be split on the second group (,) leaving the first and the third with the first item and the second item respectively.
I tried to add the non-capturing pattern ?: but it doesn't seem to work.
my_string <-
"FIRST item,SECOND, item,third ITEM,FOURTH item"
strsplit(my_string, "(?:[^ ])(,)(?:[^ ])")[[1]]
I get "FIRST ite""ECOND, ite""hird ITE""OURTH item" will I need a pattern to get "FIRST item""SECOND, item""third ITEM""FOURTH item".