[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: match() in gawk 3.1.1
From: |
Aharon Robbins |
Subject: |
Re: match() in gawk 3.1.1 |
Date: |
Tue, 4 Nov 2003 15:48:17 +0200 |
This is fixed in 3.1.3. Enjoy. --Arnold
> Date: Mon, 3 Nov 2003 22:13:21 +0100
> To: address@hidden
> From: Ingo Tomahogh-Willms <address@hidden>
> Subject: match() in gawk 3.1.1
>
> Hello,
>
> in version 3.1.1 of gawk, match() completely stops creating the elements
> of its array argument after it has reached a paranthesized subexression
> that is optional and not present, even if subsequent paranthesized
> subexpressions do exist:
>
> $ gawk --version
> -| GNU Awk 3.1.1
> -| Copyright (C) 1989, 1991-2002 Free Software Foundation.
> ...
>
> $ gawk 'BEGIN {match("axyze", /(x)(y)?(z)/, A); print A[0];
> if(3 in A)print "YES"; print A[1]","A[2]","A[3]"."}'
> -| xyz
> -| YES
> -| x,y,z.
> OK: All 3 subexpressions are present in the string, so A[3] is the
> substring matching the 3rd subexpression, "z".
>
> $ gawk 'BEGIN {match("axze", /(x)(y)?(z)/, A); print A[0]; if(3
> in A)print "YES"; print A[1]","A[2]","A[3]"."}'
> -| xz
> -| x,,.
> BUG: The 2nd subexpression is not present in the string, but the 3rd
> subexpression is. Nevertheless, A[3] does not exist.
>
> I wasn't able to test this with version 3.1.3 yet, so I apologize if
> this has been fixed already.
>
> Greetings,
> Ingo Tomahogh-Willms
> --
> Freundliche Grüße,
>
> Ingo Tomahogh-Willms.
>
> <mailto: address@hidden>