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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.