[R] Regular Expression returning unexpected results

Sarah Goslee sarah.goslee at gmail.com
Tue Oct 29 18:44:25 CET 2013


On Tue, Oct 29, 2013 at 1:13 PM, Lopez, Dan <lopez235 at llnl.gov> wrote:
> grep("^([a-z]+) +\1 +[a-z]+ [0-9]",lines)

Your expression has a typo:

R> grep("^([a-z]+) +\\1 +[a-z]+ [0-9]",lines)
[1] 2


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list