Re: [Rd] Regular expressions

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 23 Sep 2006 - 09:43:35 GMT

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@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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat Sep 23 19:45:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 23 Sep 2006 - 14:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.