[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Regex problem with gawk 4.1.2
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Regex problem with gawk 4.1.2 |
Date: |
Thu, 14 May 2015 14:09:50 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi. Thanks for the report.
As Andy answered, there is a bug in this area. If you change your code to
if (ref ~ /[[,]/) { print "whoo"; }
you should be OK. I plan to release 4.1.3 fairly soon, since this is
a fairly critical bug.
Thanks!
Arnold
> Hi,
>
> One of my venerable awk programs, which I've tried to keep compatible with
> awk,
> nawk, and gawk for close to 15 years, suddenly broke when run with gawk 4.1.2.
>
> I've reduced the problem to the following little snippet. The problem seems
> to be with inclusion of an unquoted '[' character within the regex bracket
> expression, but not as the first character. According to the manual this
> should
> work [1], and it has indeed worked for me as long as I've worked with awk, but
> doesn't do so any more in 4.1.2:
>
> #!/opt/local/bin/gawk -f
> BEGIN {
> ref = ",";
> if (ref ~ /[,[]/) { print "whoo"; }
> }
>
> My copy of gawk 4.1.2 is running on OS X, version 10.9.5, installed with
> macports,
> and gives its version number as "GNU Awk 4.1.2, API: 1.1"
>
>
> Best regards,
>
> Henrik
>
> [1] http://www.gnu.org/software/gawk/manual/html_node/Bracket-Expressions.html