New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract() does not honor regex options #693
Comments
I think this is just a documentation issue; due to stringr's use of stringi (which has heavy compilation requirements) we unfortunately can't use stringr everywhere within the tidyverse. |
Fixes tidyverse#693 Note that we're using a stringi regular expression. Also note it has to be a string, not something like a stringr::regex
My explanation was a bit incomplete since tidyr actually does use stringi — I don't think we want to commit to any specific regular expression engine in the docs, since we might want to change them out in the future. |
This comment has been minimized.
This comment has been minimized.
@DavisVaughan I think we can now commit to |
extract()
does not honor regex options. Here's a reprex:I saw #223, but I think this is a different issue.
I'm really not familiar with R as a language or the tidyverse as a system so I'm not sure if this is intentional behavior, but I wasn't able to find documentation that
extract()
treats the regex as a simple character vector. The documentation forextract()
refers to it only as "a regular expression."The apparent issue is this line in extract.R:
I would expect it to pass the options of the regex to
stri_match_first_regex
using itsopts_regex
parameter.As far as I can tell, tidyr doesn't import stringr at all. So
extract()
s lack of awareness of stringr's regex types could be an intentional design choice of the tidyverse. But that should still be better documented.I attempted to write a fix with the assumption that use of stringr was allowed, but ran into the problem that stringr's method of getting options from a regex seems to be
opts()
, which is not exported. In any case, my changes wereThe text was updated successfully, but these errors were encountered: