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

From: <xiao.gang.fan1_at_libertysurf.fr>
Date: Wed 03 Jan 2007 - 17:55:22 GMT


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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Jan 04 20:20:14 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 04 Jan 2007 - 11:31:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.