[R] gsub regexp question
ALBERTO VIEIRA FERREIRA MONTEIRO
albmont at centroin.com.br
Wed Oct 15 13:42:00 CEST 2014
I just found a curious behaviour of regexp and I'd like to share with y'all.
gsub("^([[:alnum:]\\[\\]]*).*", "\\1", "array[n] <- 10", perl=T) #
works as expected ("array[n]")
gsub("^([[:alnum:]\\[\\]]*).*", "\\1", "array[n] <- 10", perl=F) #
doesn't work ("a")
I didn't find anything in the documentation explain what's going on,
and why the second gsub doesn't work.
Alberto Monteiro
More information about the R-help
mailing list