bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] lower case using [a-z] version 3.1.5


From: John Haque
Subject: Re: [bug-gawk] lower case using [a-z] version 3.1.5
Date: Sat, 5 Nov 2011 07:32:07 -0500
User-agent: Mutt/1.4.2.2i

On Fri, Nov 04, 2011 at 07:47:03PM -0400, Mark Wambach wrote:
> The following doesn't work:
> 
> echo "AasdfasfJ" | gawk 'BEGIN{IGNORECASE=0;} 
> $1 ~ /^A[a-z]+$/ { print; }'

This should not work i.e. should print nothing. With IGNORECASE=0,
J will not match j. May be you wanted to set IGNORECASE to 1?

Without knowing your locale setup and what regex library was used
to compile gawk, it is hard to tell if there is a bug or not.
Please read

  http://www.gnu.org/s/gawk/manual/html_node/Ranges-and-Locales.html

to find out how locale setup affects range matching.


> 
> The following does work:
> echo "AasdfasfJ" | gawk 'BEGIN{IGNORECASE=0;} 
> $1 ~ /^A[[:lower:]]+$/ { print; }'
> 
> The 2nd one warns me about IGNORECASE being a gawk extension:
> echo "Aasdfasf" | gawk -W lint 'BEGIN{IGNORECASE=0;} $1 ~ /^A[[:lower:]]+$/ { 
> print; }'
> gawk: warning: `IGNORECASE' is a gawk extension
> Aasdfasf

This shouldn't work in C locale and gawk compiled with a working regex
library. In fact, it does not work for me using either the current
version of gawk (4.0) or the vendor supplied 3.1.5 which is
still in my linux machine.

Thank,

John


> 
> It seems to be broken.  Am I missing something?
> 
> 
> On SunOS 5.10
> address@hidden>echo "AasdfasfJ" | awk 'BEGIN{IGNORECASE=0;} 
> $1 ~ /^A[a-z]+$/ { print; }'
> address@hidden>echo "Aasdfasf" | awk 'BEGIN{IGNORECASE=0;} 
> $1 ~ /^A[a-z]+$/ { print; }'
> Aasdfasf
> 
> This is what I would have expected.
> 
> Thanks,
> Mark Wambach
> 



reply via email to

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