Try the fixed argument: grep(".$^", c("Test.$^", "Test"), fixed = TRUE)
On Fri, Nov 13, 2009 at 11:33 AM, Hadley Wickham <had...@rice.edu> wrote: > Hi all, > > Is there a method for escaping strings to be used regular expressions? > i.e. if I have a user supplied string that I'd like to use as a fixed > component is there a method that will turn (e.g.) ".$^" into > "\\.\\$\\^" ? > > Thanks, > > Hadley > > -- > http://had.co.nz/ > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.