fmt_rg: Regexps for date/time components

View source: R/parse_dttm_fmt.R

fmt_rgR Documentation

Regexps for date/time components

Description

fmt_rg() creates a character vector of named patterns to match individual date/time components.

Usage

fmt_rg(
  sec = "(\\b\\d|\\d{2})(\\.\\d*)?",
  min = "(\\b\\d|\\d{2})",
  hour = "\\d?\\d",
  mday = "\\b\\d|\\d{2}",
  mon = stringr::str_glue("\\d\\d|{months_abb_regex()}"),
  year = "(\\d{2})?\\d{2}",
  na = NULL,
  sec_na = na,
  min_na = na,
  hour_na = na,
  mday_na = na,
  mon_na = na,
  year_na = na
)

Arguments

sec

Regexp for the second component.

min

Regexp for the minute component.

hour

Regexp for the hour component.

mday

Regexp for the month day component.

mon

Regexp for the month component.

year

Regexp for the year component.

na

Regexp of alternatives, useful to match special values coding for missingness.

sec_na

Same as na but specifically for the second component.

min_na

Same as na but specifically for the minute component.

hour_na

Same as na but specifically for the hour component.

mday_na

Same as na but specifically for the month day component.

mon_na

Same as na but specifically for the month component.

year_na

Same as na but specifically for the year component.

Value

A named character vector of named patterns (regexps) for matching each date/time component.


sdtm.oak documentation built on April 3, 2025, 9:37 p.m.