On Thu, Aug 26, 2010 at 6:16 AM, Dimitri Shvorob <dimitri.shvo...@gmail.com> wrote: > >> grep("f[0-9]+=", "f1=5,f22=3,", value = T) > [1] "f1=5,f22=3," > > How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) > would be even better). >
strapply in gsubfn extracts matches based on content rather than delimiters. See home page for more info http://gsubfn.googlecode.com > library(gsubfn) > x <- "f1=5,f22=3," > strapply(x, "f\\d+")[[1]] [1] "f1" "f22" -- GKX Group GKX Associates Inc. 1-877-GKX-GROUP ggrothendieck at gmail.com ______________________________________________ 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.