Displaying 1 result from an estimated 1 matches for "diffondendo".
2011 Jun 05
1
Negating two identical characters with regular expressions
Hello all,
Let's say I have a character string
"Race-ethnicity-----coding information"
I want to extract all text before the multiple dashes, including the word
"ethnicity."
I wrote a handy function to extract the first matched text:
grepcut <- function(pattern,x){
start.and.length <- regexpr(pattern,x)
substring(x,start.and.length,start.and.length