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

ignore_case doesn't work for str_replace_all when using named vector #207

Closed
alanault opened this issue Jan 12, 2018 · 0 comments
Closed

ignore_case doesn't work for str_replace_all when using named vector #207

alanault opened this issue Jan 12, 2018 · 0 comments
Labels
bug

Comments

@alanault
Copy link

@alanault alanault commented Jan 12, 2018

Hi,

I'm using str_replace_all with a named vector of patterns and replacements, so that they're all applied to a single character vector.

However, the ignore_case = TRUE argument seems to not have any effect:

# patterns and replacement
a <- c(apples = "fruit", pears = "fruit")

# test strings
test1 <- c("apples", "pears")
test2 <- c("APPLES", "PEARS")

# works; but doesn't need to ignore case
stringr::str_replace_all(test1, stringr::regex(a, ignore_case = TRUE))

# doesn't work 
stringr::str_replace_all(test2, stringr::regex(a, ignore_case = TRUE))

Is the ignore_case argument not meant to work when using a named vector, or is there another way I should be calling this?

many thanks
Alan

@hadley hadley added the bug label May 8, 2018
@hadley hadley closed this in 98b4fa8 May 8, 2018
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