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 incompatibility #129

Closed
hadley opened this Issue Dec 6, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@hadley

hadley commented Dec 6, 2014

renozao/NMF#24 (comment)

stri_match returns NA for optional groups that didn't match, where str_match should return "". Could we please have an omit_na option for stringr?

# dev stringr
> str_match("abcd", "^(:)?([^:]*)(:)?$")
     [,1]   [,2] [,3]   [,4]
[1,] "abcd" NA   "abcd" NA  
> str_match(":abcd", "^(:)?([^:]*)(:)?$")
     [,1]    [,2] [,3]   [,4]
[1,] ":abcd" ":"  "abcd" NA  

# CRAN stringr
> str_match("abcd", "^(:)?([^:]*)(:)?$")
     [,1]   [,2] [,3]   [,4]
[1,] "abcd" ""   "abcd" ""  
> str_match(":abcd", "^(:)?([^:]*)(:)?$")
     [,1]    [,2] [,3]   [,4]
[1,] ":abcd" ":"  "abcd" ""  

@gagolews gagolews added this to the stringi-0.4 milestone Dec 6, 2014

@gagolews gagolews self-assigned this Dec 6, 2014

@gagolews gagolews closed this in e191d10 Dec 6, 2014

@gagolews

This comment has been minimized.

Show comment
Hide comment
@gagolews

gagolews Dec 6, 2014

Owner
> stri_match_first_regex(c("abcd", ":abcd", ":abcd:"), "^(:)?([^:]*)(:)?$")
     [,1]     [,2] [,3]   [,4]
[1,] "abcd"   NA   "abcd" NA  
[2,] ":abcd"  ":"  "abcd" NA  
[3,] ":abcd:" ":"  "abcd" ":" 
> stri_match_first_regex(c("abcd", ":abcd", ":abcd:"), "^(:)?([^:]*)(:)?$", cg_missing="")
     [,1]     [,2] [,3]   [,4]
[1,] "abcd"   ""   "abcd" ""  
[2,] ":abcd"  ":"  "abcd" ""  
[3,] ":abcd:" ":"  "abcd" ":" 

==> done

Owner

gagolews commented Dec 6, 2014

> stri_match_first_regex(c("abcd", ":abcd", ":abcd:"), "^(:)?([^:]*)(:)?$")
     [,1]     [,2] [,3]   [,4]
[1,] "abcd"   NA   "abcd" NA  
[2,] ":abcd"  ":"  "abcd" NA  
[3,] ":abcd:" ":"  "abcd" ":" 
> stri_match_first_regex(c("abcd", ":abcd", ":abcd:"), "^(:)?([^:]*)(:)?$", cg_missing="")
     [,1]     [,2] [,3]   [,4]
[1,] "abcd"   ""   "abcd" ""  
[2,] ":abcd"  ":"  "abcd" ""  
[3,] ":abcd:" ":"  "abcd" ":" 

==> done

@hadley

This comment has been minimized.

Show comment
Hide comment
@hadley

hadley Apr 15, 2015

This is a blocker for stringr 1.0.0. Are you planning on releasing a new version of stringi soon?

hadley commented Apr 15, 2015

This is a blocker for stringr 1.0.0. Are you planning on releasing a new version of stringi soon?

@hadley

This comment has been minimized.

Show comment
Hide comment
@hadley

hadley Apr 15, 2015

Oh no, I need to use the new argument. Oops!

hadley commented Apr 15, 2015

Oh no, I need to use the new argument. Oops!

@gagolews

This comment has been minimized.

Show comment
Hide comment
@gagolews

gagolews Apr 15, 2015

Owner

The only new thing in upcoming stringi 0.5 that slightly affects stringr is #133, #139 (text wrap)
Release time of stringi_0.5 == I wish soon, but I'm stuck with other duties right now :/

Owner

gagolews commented Apr 15, 2015

The only new thing in upcoming stringi 0.5 that slightly affects stringr is #133, #139 (text wrap)
Release time of stringi_0.5 == I wish soon, but I'm stuck with other duties right now :/

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