whole_word
From rebus v0.1-3
by Richard Cotton
Match a whole word
See whole_word
.
Community examples
andrecolli22@hotmail.it
at
Jul 4, 2018
rebus
v0.1-3
### This function forces the matching only when its argument appears as a stand-alone word ``` > library(rebus) > library(stringr) > string <- "I want an ant" [1] 3 # The functions str_count() simply counts how many times the pattern is matched # This quickly shows how whole_word() changed the matching behaviour > pattern_1 <- "an" > str_count(string,pattern_1) > pattern_2 <- whole_word("an") > str_count(string,pattern_2) [1] 1 ```