[R] regex [:digit:] gives diffrent result

Tilmann Faul Tilmann_Faul at t-online.de
Mon Feb 6 19:36:53 CET 2017


Using R is a grate advantage, thanks for your work.

Using regex under R 3.1.1, Debian 8.6 jessy works fine.

str_detect("16-03-08", "[:digit:]{2}")
[1] TRUE
str_detect("16-03-08", "[0-9]{2}")
[1] TRUE

runing the same code under R 3.3.2 backport, Debian 8.6 jessy gives a
different result. This is also a different computer.

str_detect("16-03-08", "[:digit:]{2}")
[1] FALSE
str_detect("16-03-08", "[0-9]{2}")
[1] TRUE

Is this intended?
My workaround is using [0-9] instead of [:digit:].

Thanks
Tilmann



More information about the R-help mailing list