stringr icon indicating copy to clipboard operation
stringr copied to clipboard

Unexpected results for `str_starts()` when use pattern containing `"|"`

Open psychelzh opened this issue 1 year ago • 2 comments

See the following example:

stringr::str_starts("A1", "T")
#> [1] FALSE
stringr::str_starts("A1", "\\d")
#> [1] FALSE
stringr::str_starts("A1", "T|\\d")
#> [1] TRUE

Created on 2022-07-31 by the reprex package (v2.0.1)

psychelzh avatar Jul 31 '22 13:07 psychelzh

Also found this SO. So perhaps it is a documentation issue?

But I do think it is better to support this behavior because base startsWith() supports this, and it is more intuitive.

psychelzh avatar Jul 31 '22 13:07 psychelzh

Ah, I am sorry. This might have been solved by #340. So when will there be a new release?

psychelzh avatar Aug 01 '22 09:08 psychelzh

Not sure. Hopefully in the next couple of months.

hadley avatar Aug 12 '22 11:08 hadley