[Rd] pb in regular expression with the character "-" (PR#9437)

xiao.gang.fan1 at libertysurf.fr xiao.gang.fan1 at libertysurf.fr
Wed Jan 3 18:55:22 CET 2007


Full_Name: FAN
Version: 2.4.0
OS: Windows
Submission from: (NULL) (159.50.101.9)


These are expected:

> grep("[\-|c]", c("a-a","b"))
[1] 1

> gsub("[\-|c]", "&", c("a-a","b"))
[1] "a&a" "b"  

but these are strange:

> grep("[d|\-|c]", c("a-a","b"))
integer(0)

> gsub("[d|\-|c]", "&", c("a-a","b"))
[1] "a-a" "b"  

Thanks



More information about the R-devel mailing list