Skip to content

regex [:digit:] gives diffrent result

2 messages · Tilmann Faul, William Dunlap

#
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
#
Shouldn't your "[:digit:]" be "[[:digit:]]"?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Feb 6, 2017 at 10:36 AM, Tilmann Faul <Tilmann_Faul at t-online.de> wrote: