Skip to content
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

Documentation for str_subset & str_detect imply pattern can be empty, but that gives an error #508

Open
yadbor opened this issue Apr 25, 2023 · 0 comments

Comments

@yadbor
Copy link

yadbor commented Apr 25, 2023

The documentation for str_detect and str_subset should be updated to say that pattern cannot be empty or boundary().

Currently both say "An empty pattern, "", is equivalent to boundary("character")", implying that they will accept a boundary() as the pattern, but this gives an error as below.

> fruit <- c("apple", "banana", "pear", "pineapple")
> str_subset(fruit, "")
Error in `str_subset()`:
! `pattern` can't be the empty string (`""`).

> fruit <- c("apple", "banana", "pear", "pineapple")
> str_subset(fruit, boundary("character"))
Error in `str_subset()`:
! `pattern` can't be a boundary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants