Prof Brian Ripley <[EMAIL PROTECTED]> wrote: >Peter J. Acklam wrote: > > > Marcelo Luiz de Laia wrote: > > > > > > 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?
I should have said "many applications", not "most applications." I use Solaris, and I don't know one Solaris application which allows it, including egrep, oawk, and nawk. And no version of Perl allows it. GNU-tools allow it, but in an inconsistent way. GNU Emacs treats `*x' as `\*x' (match a literal star and a literal x), but GNU grep (version 2.5) treats `*x' as `.*x' (match anything up to and including the first x), which is something quite different. It's a mess, it's inconsistent, and it's not portable. I suggest people stop using "*..." and use "\*..." or ".*..." depending on what is wanted. Peter -- Peter J. Acklam - [EMAIL PROTECTED] - http://home.online.no/~pjacklam ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
