I would like to match for the entire word. If you see below, I want the grep for "is" to show only 4 in the output since only "this is a line", contains the entire word "is"
I also tried searching using ^ and $ as shown below, but I'm looking for a string which exactly matches "is". It may contains other words also, as long as the word "is" is present as a separate word
> lines = c("this","this","this","this is a line")
> grep("is",lines)
[1] 1 2 3 4
> grep("^is$",lines)
integer(0)