[Rd] Regular expressions
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Sep 23 11:43:35 CEST 2006
On Sat, 23 Sep 2006, Dominick Samperi wrote:
> When I type
>
> ls("package:base", pattern="log*")
> functions with names like "floor" and
> "Sys.setlocale" are included. I don't
> think this is how "*" is supposed to work.
>
> To get the desired response I have to use:
> ls("packge:base", pattern="logg*")
If you want a wildcard-like behaviour, use glob2rx, e.g.
> glob2rx("log*")
[1] "^log"
> I thought "log*" means "log" followed by anything?
Please read ?regexp.
It means 'lo' followed by zero or more occurrences of 'g'.
--
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-devel
mailing list