[R] Doubt about pattern
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Jan 30 13:29:59 CET 2004
On Fri, 30 Jan 2004, Peter J. Acklam wrote:
> Marcelo Luiz de Laia wrote:
>
> > I have a very simple problem. I have several files in a same
> > directory. I would like to send for an object only the files
> > that finish in ".sens.". I execute the command below,
> >
> > > files <- dir(pattern="*.sens")
>
> That's not even a valid regular expression in most applications,
> but "dir" does allow it, for some reason. Anyway, I think you
It is a valid regex in GNU's regex code as used by R, and all the GNU and
non-GNU applications I tried accepted it. `*' matches itself when not
used as a repetition qualifier. (I tried several greps, including those
claiming strict POSIX compliance.)
So, can you please list the `most applications' you tried or give a
reference for your assertion?
> are mixing globs and regular expressions. If "*.sens" is a glob,
> then it will find all files ending with ".sens", which is not
> the same as ".sens." which you said above.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list