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

Closed
kindlychung opened this Issue Oct 25, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@kindlychung

kindlychung commented Oct 25, 2016

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 in 9ef98cf Dec 30, 2016

@hadley

This comment has been minimized.

Member

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