[R] Help with grep (and similar functions)

Alberto Monteiro albmont at centroin.com.br
Wed Mar 28 14:18:01 CEST 2007


This works:

grep("([A-Za-z]*) ", "Aaaa 3 x 0 Bbbb") # 1

This also works:

grep("([A-Za-z]*) ", "Aaaa 3 x 0 Bbbb", value=T) # Aaaa 3 x 0 Bbbb

However, I want a grep that returns the _matched_ pattern, which, in this 
case, would be Aaaa. How can I do it?

Alberto Monteiro



More information about the R-help mailing list