[R] regex scares me
Roger D. Peng
rdpeng at gmail.com
Mon Aug 28 20:17:51 CEST 2006
You might want to try 'glob2rx()', as in
grep(glob2rx("*.tab"), x)
where 'x' is a vector of strings.
-roger
Jon Minton wrote:
> Hi, apologies if this is too simple but I've been stuck on the following for
> a while:
>
>
>
> I have a vector of strings: filenames with a name before the extension and a
> variety of possible extensions
>
>
>
> I want to select only those files with:
>
> 1) a ".tab" extension
>
> AND
>
> 2) the character sequence "lad" anywhere in the name of the file before the
> extension.
>
>
>
> Surely this won't take long to do, I thought. (But I was wrong.)
>
>
>
> What's the regexp pattern to specify here?
>
>
>
> Thanks,
>
>
>
> Jon Minton
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
More information about the R-help
mailing list