issues
search
briandfoy
/
PerlPowerTools
Perl Power Tools
https://metacpan.org/pod/PerlPowerTools
Other
211
stars
53
forks
source link
grep: disable regex search for fgrep mode
#630
Closed
mknos
closed
2 months ago
mknos
commented
2 months ago
Move regex code for -v flag down to avoid modifying patterns list for fixed-string mode (-F)
Fold patterns list to lowercase for -i flag and perform substring match against lc(LINE) with index()
For -v mode (negated match), test for index() retval -1
Always do quotemeta() on pattern list for fixed-string mode so a quote (') can evaluate correctly in $match_code
test1: "perl grep -F alice names" --> no match because my names file had Alice
test2: "perl grep -Fi AlIcE names" --> now Alice matches
test3: "perl grep -Fv joe names" --> non-joe
test4: "perl grep -Fiv JOE names" --> non-joe2, fold case (excludes joe and Joe)
test5: "perl grep -F "'" names" --> correctly matches on quote
briandfoy
commented
2 months ago
changes: -f (fixed string mode) now disables pattern matching