Re: [Rd] Named backreference in gsub()?
Thanks, it works like a charm. /Henrik On Sat, Oct 3, 2009 at 7:03 AM, Gabor Grothendieck wrote: > strapply in the gsubfn package matches a regular expression and passes > each back reference as a separate argument to the indicated function, > in this case paste. Any number of back references may be used. Here > is an example where there are more than 9: > >> # pass each back reference in regular expression to function >> # returning function's output >> library(gsubfn) >> strapply("abcdefghijklmnop", "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)", paste) > [[1]] > [1] "a b c d e f g h i j" > > See home page at: http://gsubfn.googlecode.com > > On Sat, Oct 3, 2009 at 2:17 AM, Henrik Bengtsson > wrote: >> Hi, >> >> I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 >> for gsub(). Does R support *named* backreferences, and if so, what is >> the syntax? >> >> Thanks >> >> Henrik >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Named backreference in gsub()?
strapply in the gsubfn package matches a regular expression and passes each back reference as a separate argument to the indicated function, in this case paste. Any number of back references may be used. Here is an example where there are more than 9: > # pass each back reference in regular expression to function > # returning function's output > library(gsubfn) > strapply("abcdefghijklmnop", "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)", paste) [[1]] [1] "a b c d e f g h i j" See home page at: http://gsubfn.googlecode.com On Sat, Oct 3, 2009 at 2:17 AM, Henrik Bengtsson wrote: > Hi, > > I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 > for gsub(). Does R support *named* backreferences, and if so, what is > the syntax? > > Thanks > > Henrik > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Named backreference in gsub()?
Hi, I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 for gsub(). Does R support *named* backreferences, and if so, what is the syntax? Thanks Henrik __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel