as title, I am working on some gregexpr in R now, I need to search for something start with a dot, so I need to use "." (without quote), but R keep saying that it is an unrecognized escape. What can I do?
Thanks!
as title, I am working on some gregexpr in R now, I need to search for something start with a dot, so I need to use "." (without quote), but R keep saying that it is an unrecognized escape. What can I do?
Thanks!
You need to escape the backslash.
> string <- c("foo","ba.r")
> grep("\.",string)
Error: '\.' is an unrecognized escape in character string starting "\."
> grep("\\.",string)
[1] 2