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

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

Comments

@kindlychung
Copy link

@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
Copy link
Member

@hadley 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants