(i'll note that it also doesn't consider any of the unicode ways to
specify uppercase (i found 3 syntaxes for 3 different properties in a
quick search), but since perl doesn't seem to apply (?i) to those, it
doesn't really matter.)
example and suggested patch follow
$ cat foo.txt
abc
ABC
aBc
$ ack --version
ack 1.96
Running under Perl 5.8.8 at /usr/bin/perl
Copyright 2005-2011 Andy Lester.
This program is free software. You may modify or distribute it
under the terms of the Artistic License v2.0.
$ ack --noenv --text --smart-case '[A-Z]'
foo.txt
2:ABC
3:aBc
$ ack --noenv --text --smart-case '[[:upper:]]'
foo.txt
1:abc
2:ABC
3:aBc
$ cat patch
--- ack 2011-11-08 09:03:01.000000000 -0500
+++ ack.1 2011-12-19 12:02:07.000000000 -0500
@@ -1662,7 +1662,7 @@
$str = "$str\\b" if $str =~ /\w$/;
}
- my $regex_is_lc = $str eq lc $str;
+ my $regex_is_lc = $str eq lc $str && $str !~ /\Q[:upper:]/i;
if ( $opt->{i} || ($opt->{smart_case} && $regex_is_lc) ) {
$str = "(?i)$str";
}
$ ~/bin/ack --noenv --text --smart-case '[[:upper:]]'
foo.txt
2:ABC
3:aBc
--
Aaron Davies
aaron....@gmail.com
smart-case does not consider [:upper:] as a pattern containing upper
case. given that perl applies the (?i) modifier to it correctly, IMAO
it should.
> On Dec 19, 2011, at 11:05 AM, Aaron Davies wrote:
>
> > smart-case does not consider [:upper:] as a pattern containing upper
> > case. given that perl applies the (?i) modifier to it correctly, IMAO
> > it should.
>
> Any bugs or issues should be submitted to the issues queue athttps://github.com/petdance/ack/issues, not posted to the list.
relocated to https://github.com/petdance/ack/issues/205
--
Aaron Davies
aaron....@gmail.com
Actually, perl *used to* (apply the modifier correctly)... and will
again some day! ;-)
http://perl5.git.perl.org/perl.git/commitdiff/4f03b4b
Regards,
Offer Kaye