Thanks for the suggestions. gsub("hello (.*)", "\\1", "hello world")
seems simplest. Setting value=TRUE returns the whole match, not the subexpression. (I always read the man pages carefully before asking for help, gratuituous comments notwithstanding. I didn't see a solution using gregexpr; if the poster wants to point out my oversight, he is welcome to do so.) -- View this message in context: http://n4.nabble.com/regular-expression-submatch-tp1459146p1459215.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.