Find overlapping regular expression matches.

Description

Find overlapping matches for a regular expression.

Usage

1
refindall(s, pat, over = 1, ignorecase = FALSE)

Arguments

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.

Details

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.

Value

A numeric vector with the indices of starting positions of all matches.

Note

This effect can also be reached with the R function gregexpr(), see the example below.

See Also

regexp

Examples

1
2
3
4
5
refindall("ababababa", 'aba')
gregexpr('a(?=ba)', "ababababa", perl=TRUE)

refindall("AbababaBa", 'aba')
refindall("AbababaBa", 'aba', ignorecase = TRUE)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.