searchable (version 0.3.3.1)

Pattern-class: Defines or extract a search pattern

Description

Patterns defines how searches are conducted against a searchable target

Usage

pattern(object, type, ...)

## S3 method for class 'default': pattern(object = NULL, type = "std", ...)

## S3 method for class 'character': pattern(object, type = "std", ...)

## S3 method for class 'Pattern': pattern(object, type = object@type, ...)

## S3 method for class 'Searchable': pattern(object, type = object@type, ...)

## S3 method for class 'Pattern': show(object)

Arguments

object
character or pattern;
type
character; the type of match: std (default), regex, coll, fixed.
...
additional arguments to be passed to stri_opts_* functions. See details.

The pattern class defines how the search is conducted.

The function pattern is the constructor for the class. It takes a 'st

std

The default is std matching which performs matching as base R would. This is equivalent to fixed and case_insensitive = FALSE. Though the internal matching is sed.

regex

regex matching takes a regular expression for matching using

stri_*_regex functions.

coll

...

fixed

...

Examples

Run this code
pattern('hello')
  pattern('hello', type="regex", boundary="starts_with" )

Run the code above in your browser using DataCamp Workspace