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

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

Re: match finds wrong space.


From: Davide Brini
Subject: Re: match finds wrong space.
Date: Thu, 8 Jul 2010 09:31:34 +0100
User-agent: KMail/1.13.3 (Linux/2.6.32-gentoo-r10; KDE/4.4.4; x86_64; ; )

On Thursday 08 Jul 2010 09:17:03 Hermann Peifer wrote:

> >> Hi. Current gawk is correct, and 3.0.3 is wrong. You'll note that
> >> following the \040 for a space you have [a-z]. This matches *lower case
> >> letters*; the "A" following the first first is an upper case letter.
> > 
> > But it's matched in his example.
> > 
> >> So, there's no bug.
> > 
> > He is saying that
> > 
> > match( s, /\040[a-z]/ )
> > 
> > on the line
> > 
> > "Mary Ann jane"
> > 
> > gives 5 (meaning [a-z] matches the "A"), whereas it should give 9.
> > 
> > I explained the reason for that in my post.
> 
> Davide,
> 
> Soemone else already explained that this is expected behaviour. 

Er, yes, that was me.

> Unless your are in C locale, the character range [a-z] can expanded to just
> about anything. Simplified  examples are:
> 
> aBbCc...XxYyZz  or  aAbBcC...xXyYz
> 
> Your locale is probably similar to the latter example, this is why it
> matches an uppercase A. In non-C locales, use character classes like
> [:lower:] and [:upper:] instead of character ranges like [a-z] and [A-Z].

Exactly.

-- 
D.



reply via email to

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