[R] regular expression submatch?

sjaffe sjaffe at riskspan.com
Mon Feb 1 20:54:07 CET 2010


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.



More information about the R-help mailing list