rr: Reverse Regex

View source: R/reverseRegex.R

rrR Documentation

Reverse Regex

Description

A function to find all unique 'general' formats in a vector. Useful for e.g. tag formats, date formats, etc.

Usage

rr(vec, unique = F)

Arguments

vec

A character vector that you want to parse into all general formats.

unique

Logical; whether to return one result per element of the vector (unique = F, default) or return just all unique formats (unique = T).

Value

If unique = F (default), returns a vector with the same length as vec, containing general formats where '0' stands in for digits 0-9; 'a' stands in for any lowercase letter, and 'A' stands in for any uppercase letter. Non-alphanumeric characters are left as is. If unique = T, this function returns instead a vector of all unique formats, which may not have the same length as vec.

Examples

rr(c("09-07-2021", "9/7/21", "2021-09-07"))

MFEh2o/MFEUtilities documentation built on May 6, 2023, 1:33 p.m.