search for: tmillard

Displaying 2 results from an estimated 2 matches for "tmillard".

Did you mean: millard
2011 Feb 25
0
Named capture in regexp
Dear R core developers, One feature from Python that I have been wanting in R is the ability to capture groups in regular expressions using names. Consider the following example in R. > notables <- c(" Ben Franklin and Jefferson Davis","\tMillard Fillmore") > name.rex <- "(?<first>[A-Z][a-z]+) (?<last>[A-Z][a-z]+)" > (parsed <- regexpr(name.rex,notables,perl=TRUE)) [1] 3 2 attr(,"match.length") [1] 12 16 attr(,"capture.start") [,1] [,2] [1,] 3 7 [2,] 2 10 attr(,&quot...
2024 Jan 29
1
strcapture performance when perl = TRUE
...} utils:::conformToProto(out,proto) } else { strcapture(pattern,x,proto,perl,useBytes) } } Now comparing with strcapture we can expand the named capture example from the grep documentation: notables <- c( " Ben Franklin and Jefferson Davis", "\tMillard Fillmore", "Bob", NA_character_ ) regex <- "(?<first>[[:upper:]][[:lower:]]+) (?<last>[[:upper:]][[:lower:]]+)" proto = data.frame("", "") (strcapture(regex, notables, proto, perl = TRUE)) X.. X...1 1 Ben Franklin 2...