bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Strange matching behavior


From: Davide Brini
Subject: Re: [bug-gawk] Strange matching behavior
Date: Sun, 12 Oct 2014 23:28:02 +0200

On Sun, 12 Oct 2014 18:41:13 +0300, Aharon Robbins <address@hidden>
wrote:

> Hi.  Re this:
> 
> > However, if I add some other characters to the list ("." and "*" here),
> > gawk fails:
> >
> > $ printf '%s\n' '[' ']' '.' '*' '$' | awk '/[][.*]/ { print "<" $0
> > ">" }' awk: cmd. line:1: error: Unmatched [ or [^: /[][.*]/
> 
> I traced this through in a debugger.
> 
> The "[." is seen as the opening characters in a POSIX collating sequence.
> If you remove the "." or swap the order of the "." and the "*", it
> works as expected.
> 
> So, it's not really a bug after all.  The error message is not as helpful
> as it could/should be, but that's from the GLIBC regex code, and the
> error of unmatched [ or [^ is returned in a lot of cases.

Of course, that makes perfect sense. I totally forgot about collating
sequences. Thanks!

-- 
D.



reply via email to

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