I thought that I can use metacharacters such as \w to match word characters
with one backslash.  But for some reason, I need to include two backslashes.

> grepl(pattern='\w', x="what")
Error: '\w' is an unrecognized escape in character string starting "\w"

> grepl(pattern='\\w', x="what")
[1] TRUE

I can't find the reason for this on the help pages.  Does anyone know why?

Thanks!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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