gregexprind: Pattern Matching and Extraction

Description Usage Arguments Value Author(s) See Also Examples

View source: R/gregexprind.R

Description

Function to extract a certain index from gregexpr().

Usage

1

Arguments

pattern

Character string containing a regular expression to be searched in text.

text

Character vector where the search is performed.

n

Numeric value or character string "last" to extract nth or last position of pattern in each value of text.

...

Arguments passed to function gregexpr().

Value

Numeric vector of length length(text).

Author(s)

Sven E. Templer

See Also

See gregexpr for further information on arguments.
See regex for the use of regular expressions.

Examples

1
2
3
4
5
6
7
#

gregexprind(c("a"),c("ababa","ab","xyz",NA), 1)
gregexprind(c("a"),c("ababa","ab","xyz",NA), 2)
gregexprind(c("a"),c("ababa","ab","xyz",NA), "last")

#

setempler/miscset documentation built on May 29, 2019, 8 p.m.