I'm trying to write regular expressions in R to detect a word that can occur anywhere within a string, but only when it occurs as an entire word. e.g. in
samplestr <- c("LT BLAHBLAH", "BLAH LT BLAH", "BLAHLT BLOO")
I want to detect all occurances of "LT" but not cases where a word contains LT within a larger group. Desired output of grepl("regex that works",samplestr) (or similar string detection function) would be:
TRUE TRUE FALSE