Message-ID: <4AEEFB84.4060608@gmail.com>
Date: 2009-11-02T15:32:20Z
From: Adaikalavan Ramasamy
Subject: partial matching with grep()
In-Reply-To: <4AEEF359.8020606@unipa.it>
Try
grep( "\\.x$", c("a.x" ,"b.x","a.xx"),value=TRUE)
The $ means end-of-line (while ^ means start-of-line). And special
characters like dot needs to be escaped twice.
Regards, Adai
Vito Muggeo (UniPa) 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
>