I know that there is a similar topic on the forum, but there is no answer to my question, and I tried in different ways (R regex - extract words beginning with @ symbol). I need to write out all words that do not have a symbol in front of them.
Below is a code that cuts out all words that contain the #sign and the result of this action.
tweeter <- c("#tweeter tweet", "h#is", "tweet #tweeter2", "twet")
str_extract_all(tweeter, "(?<=\\B\\#)[^\\s]+")
Result of it:
[[1]]
[1] "tweeter"
[[2]]
character(0)
[[3]]
[1] "tweeter2"
[[4]]
character(0)
Now the code with which he tries to display all the words without # at the beginning.
regmatches(tweeter, gregexpr("\\B#\\S+", tweeter), invert = T)
I would like to display a list of words that don't start with #just don't know how to write it properly.