| str.locate.all | R Documentation |
Finds start and end positions of all substrings that match pattern
## S3 method for class 'locate.all' str(str, pattern, fixed = TRUE, perl = FALSE, ignore = NULL, ignore.pos = NULL, only.pos = NULL)
ignore.pos |
a logical vector or logical matrix indicating which locations of str shall be ignored in the search |
a list, of matrices n * 2 matrices. The first column is the start position, second column end position of each match
## Not run:
str.locate.all("0120121","1")
str.locate.all(c("0120121","abce","011"),"1")
str = c("0120121","abce","011bb1")
#str = c("0120121")
ignore = rep(FALSE,max(nchar(str)))
ignore[c(2:4)] = TRUE
str.locate.all(str,"1",ignore=ignore)
ignore.pos = rbind(c(2,4))
str.locate.all(str,"1",ignore.pos=ignore.pos)
str.locate.all(str,c("1","b","a"),ignore=ignore)
str = c("0120121")
str.locate.all(str,c("1","b","2"),ignore=ignore)
# Compare regular expression matching
str = c("012ab0121","adch3b23","0123")
gregexpr("[ab]*",str)
str_locate_all(str,"[ab]*")
str.locate.first(str,"[ab]*",fixed=FALSE)
str.locate.all(str,"[ab]*",fixed=FALSE)
str.locate.all(str,c("[ab]*","3+","0*"),fixed=FALSE)
str.locate.first(str,c("[ab]*","2","0*"),fixed=FALSE)
str.locate.all(str,"ab",fixed=FALSE)
return(ret)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.