[Rd] The regular expressions in compareVersion()

Yihui Xie xie at yihui.name
Thu Apr 24 19:11:53 CEST 2014


I guess the backslash should not be used as the separator for
strsplit() in compareVersion(), because the period in [.] is no longer
a metacharacter (no need to "escape" it using a backslash):

> compareVersion
function (a, b)
    a <- as.integer(strsplit(a, "[\\.-]")[[1L]])
    b <- as.integer(strsplit(b, "[\\.-]")[[1L]])
<environment: namespace:utils>

A similar regular expression problem also exists in the Sweave syntax
(for \Sexpr{}), and I have reported it once. It was fixed but the fix
was immediately reverted for some reason:

Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name

More information about the R-devel mailing list