Prof Brian Ripley wrote: > > Actually, that's a valid regex in any of the variants offered. A more > conventional writing of it is the second of > >> f <- 'foo.bar.R' >> sub("[.][^.]*$", "", f) > [1] "foo.bar" >> sub("\\.[^.]*$", "", f) > [1] "foo.bar" >
more conventional in r, perhaps. it's not portable, due to the 'escape the escape to have an escape' feature of r when it comes to regexes; in perl, for example, /\\.[^.]*$/ would hardly do the job. vQ ______________________________________________ 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.