[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
R: [EXT] Re: Bug in function match() ?
From: |
Canarecci Mauro |
Subject: |
R: [EXT] Re: Bug in function match() ? |
Date: |
Thu, 21 Sep 2023 22:06:51 +0000 |
Thank you very much for your response
Regards
MAURO CANARECCI
Gruppo TIM - Uso Interno - Tutti i diritti riservati.
-----Messaggio originale-----
Da: Eli Zaretskii <eliz@gnu.org>
Inviato: giovedì 21 settembre 2023 20:48
A: Canarecci Mauro <mauro.canarecci@telecomitalia.it>
Cc: bug-gawk@gnu.org
Oggetto: [EXT] Re: Bug in function match() ?
> From: Canarecci Mauro <mauro.canarecci@telecomitalia.it>
> Date: Thu, 21 Sep 2023 18:39:20 +0000
>
> However, when I run (test2.awk)
>
> BEGIN {
> # convert a date string to ISO format
>
>
> date_regex=/^(0?[1-9]|1[12])\/(0?[1-9]|[12][0-9]|3[01])\/([1-2][0-9]{3})$/
> date="12/31/2023"
> if (match(date, date_regex, D)!=0) {
> print D[3] "-" D[2] "-" D[1]
> }
> }
>
> I get the following output :
> --
Try this instead:
BEGIN {
# convert a date string to ISO format
date_regex="^(0?[1-9]|1[12])/(0?[1-9]|[12][0-9]|3[01])/([1-2][0-9]{3})$";
date="12/31/2023";
if (match(date, date_regex, D)!=0) {
print D[3] "-" D[2] "-" D[1];
}
}
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone
indicate. La diffusione, copia o qualsiasi altra azione derivante dalla
conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate
ricevuto questo documento per errore siete cortesemente pregati di darne
immediata comunicazione al mittente e di provvedere alla sua distruzione,
Grazie.
This e-mail and any attachments is confidential and may contain privileged
information intended for the addressee(s) only. Dissemination, copying,
printing or use by anybody else is unauthorised. If you are not the intended
recipient, please delete this message and any attachments and advise the sender
by return e-mail, Thanks.
Rispetta l'ambiente. Non stampare questa mail se non è necessario.