regex-helpers: A half-baked extract method

regex-helpersR Documentation

A half-baked extract method

Description

A half-baked extract method

Usage

re_extract(pattern, replace, x)

extract_backticked(x)

extract_quoted(x)

is_backticked(x)

is_bracketed(x)

Arguments

pattern

character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of length 2 or more is supplied, the first element is used with a warning. Missing values are allowed except for regexpr, gregexpr and regexec.

Value

(character[1]) The substituted string if a replacement is made, or NULL otherwise.

Functions

  • extract_backticked(): Extract contents of a backtick-enclosed string

  • extract_quoted(): Extract contents of a quoted (single or double) string

  • is_backticked(): Extract contents of a backtick-enclosed string

  • is_bracketed(): Test whether contents are enclosed in brackets

Note

This implementation is considered half-baked because there's no check for whether a replacement is made that results in the same string. This case will be interpreted the same as if there was no match.


roxytypes documentation built on Oct. 16, 2024, 1:06 a.m.