Skip to content

Honor ignore_case when select is a regex with regex = TRUE - #751

Merged
jmgirard merged 1 commit into
mainfrom
hotfix-regex-ignore-case
Nov 26, 2026
Merged

jmgirard merged 1 commit into
mainfrom
hotfix-regex-ignore-case

Conversation

@jmgirard

Copy link
Copy Markdown
Contributor

ignore_case = TRUE had no effect when select was a regular expression string with regex = TRUE, because .select_char() called grep() without ignore.case. So extract_column_names(mtcars, "^C", regex = TRUE, ignore_case = TRUE) returned nothing, while regex("^C") with ignore_case = TRUE already matched cyl and carb.

This passes ignore_case through to grep() and adds a test.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change addresses case-insensitive regex-string selection with corresponding regression coverage and documentation, and no active review issues remain.

No open issues 🎉

What changed in this PR

This pull request fixes case-insensitive matching for string-based regular expressions passed with regex = TRUE, aligning behavior with the existing regex() helper.

Changes:

  • Passes ignore_case to grep() in .select_char().
  • Adds regression coverage for case-insensitive regex-string selection.
  • Documents the fix in NEWS.md.
File Description
tests/​testthat/​test-extract_column_names.R Adds regression coverage verifying case-insensitive matching for string regex selections.
R/​select_nse.R Applies ignore_case when matching regex strings against column names.
NEWS.md Documents the corrected case-insensitive regex selection behavior.

Review effort: Lite

@jmgirard
jmgirard merged commit 1158037 into main Nov 26, 2026
26 of 28 checks passed
@jmgirard
jmgirard deleted the hotfix-regex-ignore-case branch November 26, 2026 00:37
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