[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Strange matching behavior
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Strange matching behavior |
Date: |
Sun, 12 Oct 2014 18:41:13 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
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.
Thanks,
Arnold