From ripley at stats.ox.ac.uk  Sat Sep 23 11:43:35 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 23 Sep 2006 10:43:35 +0100 (BST)
Subject: [Rd] Regular expressions
In-Reply-To: <4514C6BD.8060905@DecisionSynergy.com>
References: <4514C6BD.8060905@DecisionSynergy.com>
Message-ID: <Pine.LNX.4.64.0609230939530.29367@gannet.stats.ox.ac.uk>

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




[Rd] Regular expressions
Prof Brian Ripley