> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Waverley @ Palo Alto > Sent: Sunday, August 22, 2010 3:05 PM > To: r-help > Subject: [R] how to implement string pattern extraction in R > > 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 > Check out the documentation for regexp
?regexp Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA ______________________________________________ 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.