R: sf_grepl

sf_grepl {stringfish} | R Documentation

## sf_grepl

### Description

A function that matches patterns and returns a logical vector

### Usage

    sf_grepl(subject, pattern, encode_mode = "auto")

### Arguments

`subject` | The subject character vector to search
`pattern` | The pattern to search for
`encode_mode` | The encoding type to use (UTF-8, latin1, bytes, native or auto)

### Details

The function uses the PCRE2 library, which is also used internally by R. The encoding is based on the pattern string (or forced via the encode_mode parameter). Note: the order of paramters is switched compared to the 'grepl' base R function, with subject being first. See also: https://www.pcre.org/current/doc/html/pcre2api.html for more documentation on match syntax.

### Value

A logical vector with the same length as subject

### See Also

grepl

### Examples

    x <- sf_vector(10)
    sf_assign(x, 1, "hello world")
    pattern <- "^hello"
    sf_grepl(x, pattern)

[Package stringfish version 0.12.1 Index]