Skip to content

Doubt about pattern

3 messages · Peter J. Acklam, stefano iacus, Brian Ripley

#
Marcelo Luiz de Laia wrote:

            
That's not even a valid regular expression in most applications,
but "dir" does allow it, for some reason.  Anyway, I think you
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.
Stefano Calza <stecalza at tiscali.it> wrote:
That will find files ending with ".sens", ".senss", ".sensss",
etc.

To find files ending with ".sens.", the regex is

    dir(pattern = "\\.sens\\.$")

If there is a file called just ".sens.", you have to use
"all.files = TRUE", since files beginning with a "." are
invisible.

Peter
#
On Fri, Jan 30, 2004 at 12:46:44PM +0100, Peter J. Acklam wrote:
...cut...
Ops you're perfectly right. Should not put +!!

Thanks,

Ste

  
    
#
On Fri, 30 Jan 2004, Peter J. Acklam wrote:

            
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?