stringr icon indicating copy to clipboard operation
stringr copied to clipboard

Regular expressions with `rex()` do not work anymore

Open mgirlich opened this issue 2 years ago • 1 comments

stringr::str_detect("apple", rex::rex(maybe("a")))
#> Error in `type()`:
#> ! `pattern` must be a string

Created on 2022-02-23 by the reprex package (v2.0.1)

This is because the change to the class names

regex() and friends now generate class names with stringr_ prefix

and stringr::type() is not exported so the rex package cannot create a correct type() method.

mgirlich avatar Feb 23 '22 13:02 mgirlich

Maybe the easiest fix would be to just keep type.regex <- function(x) "regex" ?

hadley avatar Apr 14 '22 22:04 hadley