knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

inferregex

The goal of inferregex is to infer the regular expression (regex)--along with other features--of a string.

Installation

You can install inferregex from GitHub with:

remotes::install_github("inferregex")

Example 1

library(inferregex)
s <- "abcd-9999-ab9"
infer_regex(s)$regex

Example 2

library(purrr)

(regex_df <- map_dfr(rownames(mtcars), infer_regex))
all(map2_lgl(regex_df$string, regex_df$regex, ~grepl(.y, .x)))


daranzolin/inferregex documentation built on Nov. 4, 2019, 9:39 a.m.