I have a character string "ab b cde"
, i.e. "ab[space]b[space]cde"
. I want to replace "space-b" and "space-c" with blank spaces, so that the output string is "ab[space][space][space][space]de"
. I can't figure out how to get rid of the second "b" without deleting the first one. I have tried:
gsub("[\\sb,\\sc]", "", "ab b cde", perl=T)
but this is giving me "a[spaces]de"
. Any pointers? Thanks.
Edit: Consider a more complicated problem: I want to convert the string "akui i ii"
i.e. "akui[space]i[space]ii"
to "akui[spaces|"
by removing the "space-i"
and "space-ii"
.