Thanks for the reply to pointing me to the grep functions. I have checked the readme page http://pbil.univ-lyon1.fr/library/base/html/grep.html before I sent the help request.
Just don't know how to extract a substring matching a pattern out of a string. Can someone give me the example code similar to that in perl to extract the prefix out of the string. Thanks much. On Sun, Aug 22, 2010 at 3:05 PM, Waverley @ Palo Alto <waverley.paloa...@gmail.com> wrote: > Hi, > > In perl, to get a substring matching a particular pattern can be > implemented like the following example: > > $x = "AAAA.txt"; > if ($x=~ /(.*?)\.txt/){ > $prefix = $1; > } > > So how to do the same thing in R? > > Can someone provide me the code sample? > > Thanks much in advance. > > -- > Waverley @ Palo Alto > -- Waverley @ Palo Alto ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.