Named Capture Regular Expressions

User-friendly wrappers for named capture regular expressions.





Informative errors when type.list is unusual.


Coveralls badge, 100% test coverage via jimhester/covr.


str_match_named was sometimes incorrectly issuing a warning when given NA subjects, but this is now fixed.

When type.list is supplied, data.frame(stringsAsFactors=FALSE) is now used to create the data.frame from the character match groups matrix. This allows simple numerical conversions using functions like as.numeric and as.integer (before, we got unexpected results since those functions take the factor ID number).


Test optional groups, set NA before calling substring to avoid "NAs introduced by coercion" warning.


stop with informative errors for pathological subjects and patterns.


first version forked from str_match*perl in my .Rprofile. There are several differences:

  • the "name" group is used for rownames,
  • the entire match is not returned (only the groups),
  • str_match_named is vectorized (str_match_perl was not),
  • names are taken from subject if present.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2019.01.14 by Toby Dylan Hocking, a month ago

Browse source code at

Authors: Toby Dylan Hocking

Documentation:   PDF Manual  

GPL-3 license

Suggests testthat, data.table, knitr, rmarkdown

See at CRAN