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

Match depends correctly #1463

Closed
wants to merge 2 commits into from
Closed

Match depends correctly #1463

wants to merge 2 commits into from

Conversation

thomasp85
Copy link
Member

This change ensures that only exact matches in imports will get ignored. Currently adding e.g. plyr to a package that already imports dplyr will silently fail. This will happen for all packages that are substrings of packages already ignored.

The proposed change adds regex "fences" around the name of the package to import to circumvent this...

This change ensures that only exact matches in imports will get ignored. Currently adding e.g. `plyr` to a package that already imports `dplyr` will silently fail. This will happen for all packages that are substrings of packages already ignored.

The proposed change adds regex "fences" around the name of the package to import to circumvent this...
@jimhester
Copy link
Member

The proper way to do this is to use word boundary anchors around the package name.

re <- "\\btest\\b"
grepl(re, "test")
#> [1] TRUE
grepl(re, "ttest")
#> [1] FALSE
grepl(re, "testt")
#> [1] FALSE
grepl(re, " test")
#> [1] TRUE
grepl(re, " test ")
#> [1] TRUE
grepl(re, " test, ")
#> [1] TRUE

@thomasp85
Copy link
Member Author

Oh, didn't know that one... Much cleaner

@jimhester jimhester added this to the 1.13.0 milestone May 3, 2017
@jimhester
Copy link
Member

Thanks! Merged in f7d4c02

@jimhester jimhester closed this May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants