I have a character vector
words <- c("somethingspan.", "..span?", "spanthank", "great to hear", "yourspan")
And I'm trying to remove span
AND punctuation from every word in the vector
> something thank great to hear your
The thing is, there's no rule if span
will appear before or after the word I'm interested in. Also, span
can be glued to: i) characters only (e.g. yourspan
), punctuation only (e.g. ..span?
) or character and punctuation (e.g. somethingspan.
).
I searched SO for the answer, but usually I see request to remove whole words (like here ) or elements of the string after/before a letter/punctuation (like here )
Any help will be appreciated