bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Case insensitivity seems to ignore lower bound of interval


From: Eric Bischoff
Subject: Re: Case insensitivity seems to ignore lower bound of interval
Date: Thu, 28 Apr 2011 13:29:15 +0200
User-agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; )

Le jeudi 28 avril 2011 12:43:52, Davide Brini a écrit :
> > > You seem to think this is gawk-specific, but in fact any locale-aware
> > > tool that uses regular expressions behaves the same (try eg with sed or
> > > grep).
> > 
> > Not here:
> > 
> > $ echo 'ijklmnopqrstuvwxyz'| sed 's/[r-z]/X/g'
> > ijklmnopqXXXXXXXXX
> > $ echo 'ijklmnopqrstuvwxyz'| sed 's/[R-Z]/X/g'
> > ijklmnopqrstuvwxyz
> 
> This is strange, since with GNU sed 4.2.1 I get
> 
> $ echo 'ijklmnopqrstuvwxyz'| sed 's/[R-Z]/X/g'
> ijklmnopqrXXXXXXXX

My first guess, according to your name, was that it is due to a difference 
between French and Italian locales, but that it is not the case:

Generating locales...
  it_CH.UTF-8... done
  it_IT.UTF-8... done
Generation complete.
(...)
$ echo 'ijklmnopqrstuvwxyz'| LANG=it_IT.UTF-8 sed 's/[R-Z]/X/g'
ijklmnopqrstuvwxyz
$ echo 'ijklmnopqrstuvwxyz'| sed 's/[R-Z]/X/g'
ijklmnopqrstuvwxyz

> So I would definitely expect grep to follow awk's and sed's behavior.

Even if their behaviours were consistent in French, which they are not, I 
would still consider that as buggy. When someone writes "|R-Z]", they 
certainly do not expect "r" to be handled differently as "s".

> > $ echo 'ijklmnopqr'| grep "[r-z]"
> > ijklmnopqr
> > $ echo 'ijklmnopqr'| grep "[R-Z]"
> 
>
> It looks like 2.5.4 was doing it, but not 2.7, so something probably
> changed in between:
>
> $ echo 'ijklmnopqrstuvwxyz' | \grep '[R-Z]'
> ijklmnopqrstuvwxyz

This is not the same test.

My list of letters in the "echo" part intentionally was stopping at "r" in the 
grep test, to concentrate on what happens to "r", without influence from what 
happens to "s".


Best,

-- 
Éric Bischoff - Bureau Cornavin
Technical writing and translations
http://www.bureau-cornavin.com
(+33) 3 68 46 00 85
sip:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]