[R] regular expression submatch?

sjaffe
Mon, 01 Feb 2010 19:54:07 -0000

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.