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

str_match and str_match_all behave inconsistently when groups are missing #134

kindlychung opened this issue Oct 25, 2016 · 1 comment


Copy link

Here is an example:

  string = "-3e9, 9E-2"
  pattern <- "([+-]?)(\\d+)(\\.\\d+)?[eE]([+-]?)(\\d+)"
  stringr::str_match_all(string = string, pattern = pattern)
  stringr::str_match(string = string, pattern = pattern)

str_match reports NA, while str_match_all reports an empty string.

@hadley hadley closed this as completed in 9ef98cf Dec 30, 2016
Copy link

hadley commented Dec 30, 2016

This seems to be the correct fix, as a while back I made str_match consistent with str_extract etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants