I noticed the following:

> strsplit("red green","\\b")
[[1]]
[1] "r" "e" "d" " " "g" "r" "e" "e" "n"

> strsplit("red green","\\W")
[[1]]
[1] "red"   "green"

I would have thought that "\\b" should give what "\\W" did. Note that:

> grep("\\bred\\b","red green")
[1] 1
## as expected

Does strsplit use a different regex engine than grep()? Or more
likely, what am I misunderstanding?

Thanks.

Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to