rematch2
Tidy output from regular expression matches
rematch2 is a wrapper around R’s base regular expression functions (regexpr and gregexpr) that returns matching results as tidy data frames instead of the base functions’ more complex output structures. It simplifies the process of extracting both complete matches and capture groups from pattern matching operations.
The package supports both named and unnamed capture groups, making it easy to extract structured data from text. It provides four main functions: re_match() and re_match_all() for extracting matches and capture groups, and re_exec() and re_exec_all() for cases where you also need the positions (start and end indices) of matches. All results are returned as tibbles, which integrate well with tidyverse workflows and are easier to work with than the nested lists returned by base R regex functions.


