Is this what you want: depends on it occurring at the endo of the string: > grep("\\.x[^x]*$",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x"
On Mon, Nov 2, 2009 at 9:57 AM, Vito Muggeo (UniPa) <vito.mug...@unipa.it> wrote: > dear all, > This is a probably a silly question. > If I type >> grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE) > [1] "a.x" "b.x" "a.xx" > > Instead, I would like to obtain only > "a.x" "b.x" > How is it possible to get this result with grep()? > > many thanks for your attention, > best, > vito > > -- > ==================================== > Vito M.R. Muggeo > Dip.to Sc Statist e Matem `Vianelli' > Università di Palermo > viale delle Scienze, edificio 13 > 90128 Palermo - ITALY > tel: 091 6626240 > fax: 091 485726/485612 > http://dssm.unipa.it/vmuggeo > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.