Skip to content
Back to formatted view

Raw Message

Message-ID: <x2lm3cz31d.fsf@biostat.ku.dk>
Date: 2002-11-29T17:41:50Z
From: Peter Dalgaard
Subject: Regular Expressionsionism
In-Reply-To: <sde7aef9.061@dss2.med.gu.se>

"Derek Eder" <Derek.Eder at neuro.gu.se> writes:

> Isn't there a cryptic footnote somewhere in the blue book that describes regular expressions as "a funny little language ..." ?  Well, I'm not laughing!
> 
> I've googled and Man paged, but the GREP-style solution to the following problem still eludes me:
> 
> ... Using a regular expression in the "pattern" argument to list.files() to restrict the return to filenames which
> contain both "Elstim" and "post".  E.g.,
> 
> >list.files()
> ... 
> [133] "J30710_Control_msa_amplitude_5_25_s1-30w.pre"                                                    
> [134] "J30710_Elstim_msa_amplitude_5_25_s1-30w.post"                                                    
> [135] "J30710_Elstim_msa_amplitude_5_25_s1-30w.pre"                                                     
> [136] "J30712_Control_msa_amplitude_5_25_s1-41_44-46_48w.post"                                          
> [137] "J30712_Control_msa_amplitude_5_25_s1-41_44-46_48w.pre"                                           
> [138] "J30712_Elstim_msa_amplitude_5_25_s1-17_19-43_45_48w.post"                                        
>                                        
> I have not found the key to generating the logical AND equivalent of the "|" OR infix operator, a 
> proxy for the simpleton's dream:  my.list.files(pattern="*Elstim" & "*post") 

As long a you know the order, how about "Elstim.*post" ?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._