Displaying 1 result from an estimated 1 matches for "result2list".
2011 Feb 25
0
Named capture in regexp
...mail/r-devel/attachments/20110225/819df4b2/attachment.bin>
-------------- next part --------------
### Toby Dylan Hocking, 25 feb 2011. Some R code to test my
### implementation of new named capture group features in gregexpr
gctorture(FALSE)##for debugging
### Parse result of gregexpr(,string)
result2list <- function(string,result){
  extract.substrings <- function(string,starts,lengths,names){
    subs <- substring(string,starts,starts+lengths-1)
    m <- matrix(subs,ncol=length(names))
    colnames(m) <- names
    m
  }
  N <- attr(result,"capture.names")
  lapply(seq_a...