refindall | R Documentation |
Find overlapping matches for a regular expression.
refindall(s, pat, over = 1, ignorecase = FALSE)
s |
Single character string. |
pat |
Regular expression. |
over |
Natural number, indication how many steps to go forward after a match; defaults to 1. |
ignorecase |
logical, whether to ignore case. |
Returns the starting position of all — even overlapping — matches
of the regular expression pat
in the character string s
.
The syntax for pattern matching has to be PERL-like.
A numeric vector with the indices of starting positions of all matches.
This effect can also be reached with the R function gregexpr(), see the example below.
regexp
refindall("ababababa", 'aba')
gregexpr('a(?=ba)', "ababababa", perl=TRUE)
refindall("AbababaBa", 'aba')
refindall("AbababaBa", 'aba', ignorecase = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.