csvgrep: add --ignore-case option for case-insensitive matching - #1356
Open
ChrisJr404 wants to merge 1 commit into
Open
csvgrep: add --ignore-case option for case-insensitive matching#1356ChrisJr404 wants to merge 1 commit into
ChrisJr404 wants to merge 1 commit into
Conversation
Adds an --ignore-case flag to csvgrep that matches case-insensitively for the -m (string), -r (regex) and -f (matchfile) options. Previously a case-insensitive match was only possible by embedding an inline (?i) flag in a regular expression. Default behaviour is unchanged (case-sensitive). Closes wireservice#1273
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1273.
csvgrepcurrently has no case-insensitivity toggle. As noted in the issue (and #248 before it), the only way to match case-insensitively today is to embed an inline(?i)flag inside a-rregular expression, which doesn't help the-m(string) or-f(matchfile) options at all.This adds an
--ignore-caseflag that applies to all three matchers:-m/--match— substring compared case-insensitively-r/--regex— pattern compiled withre.IGNORECASE-f/--file— matchfile lines and cell values compared lowercasedThe short
-iis already taken by--invert-match, so the option is long-form only, matching grep's--ignore-casespelling.Default behaviour is unchanged: matching stays case-sensitive unless
--ignore-caseis passed.Includes tests for
-m,-rand-f(plus a check that the default stays case-sensitive), and updates the csvgrep docs, CHANGELOG and AUTHORS.