Right you are. I didn't notice that when I last tested. Try this:
t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?:.*\n){1,8}?TOTALE EURO
+([0-9,]+)(?:.*\n){1,3}?C\.F\. +([\w]+)
and replace:
\5\n\3/\2/\1\n\6\n\7\n\n
Note: I'm not sure how many items you can have listed on your receipt which
causes me pause even with this grep string as 1 receipt with a long list
will get skipped. I couldn't come up with a way to stop the greedy over-run
if the string didn't contain the "C.F...." line. If someone else notices
something in this regard that I overlooked that would be great.
On Thursday, December 6, 2018 at 12:27:43 PM UTC-5, m.osti wrote:
>
> thank you for your concern. this GREP search is quite good: it get also
> the sale(s) without CF that are unnecessary but I can just ignore them at a
> fast glance.
>
> Il giorno mercoledì 5 dicembre 2018 18:20:28 UTC+1, ThePorgie ha scritto:
>>
>> I see you've got a script, but I like a puzzle... seems to work like this.
>>
>> t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).+?TOTALE EURO
>> +([0-9,]+).+?C\.F\. +([\w,]+)
>>
>> I used this with the extract option
>>
>>
>> On Tuesday, December 4, 2018 at 8:14:34 AM UTC-5, m.osti wrote:
>>>
>>> Hello, every day when I have to close up my shop I get this report from
>>> the cash register. I have the obligation to transmit some sales data
>>> through a web page, and I have to insert one receipt at a time, sigh.
>>> Only sales that have the "C.F." are valid.
>>> In this case I need it in the order:
>>> the date
>>> the receipt number
>>> the total euro
>>> the alphanumeric part after C.F. for example ABCDEF12G34H567I which is
>>> of 16 characters always in this order 6 alphabetic characters, 2 numbers, 1
>>> character, 2 numbers, 1 character, 3 numbers, 1 character.
>>>
>>> Now I copy them by hand and then I use a macro that I created in
>>> KeyboardMaestro. Since there is a lot of data that I don't need, to speed
>>> up I tried to extract only the necessary values through a GREP search, but
>>> I failed, failed, failed and after many attempts I decided to ask.
>>> If it were possible I would also like the date separator to be / instead
>>> of -
>>>
>>> I'm going to put on the cash register closure below: the values I need
>>> are in red.
>>> Thank you and sorry for my english.
>>> ciao from italy
>>>
>>> -m
>>>
>>> ---
>>>
>>> t_fiscale 20170422 0846 *1*
>>> EURO
>>> LENTI OFT 110,00
>>> MONTAGGIO LENTI 20,00
>>> TOTALE EURO *130,00*
>>> CONTANTE 130,00
>>> C.F. *ABCDEF12G34H567I*
>>>
>>> CASSA: 01
>>> *22-04-2017* 08:46
>>> N.SCONTR.FISCALE 1
>>> t_fiscale 20170422 0936 *2*
>>> EURO
>>> LENTI CONTATTO 100,00
>>> TOTALE EURO *100,00*
>>> CONTANTE 100,00
>>> C.F. *ABCDEF12G34H567I*
>>>
>>> CASSA: 01
>>> 22-04-2017 09:36
>>> N.SCONTR.FISCALE 2
>>> t_fiscale 20170422 1037 *3*
>>> EURO
>>> MONTATURE OFT 120,00
>>> LENTI OFT 120,00
>>> MONTAGGIO LENTI 20,00
>>> TOTALE EURO *260,00*
>>> CONTANTE 260,00
>>> C.F. *LMNOPQ89R01S234T*
>>>
>>> CASSA: 01
>>> 22-04-2017 10:37
>>> N.SCONTR.FISCALE 3
>>> t_fiscale 20170422 1055 4
>>> EURO
>>> IVA 22 8,00
>>> TOTALE EURO 8,00
>>> CONTANTE 8,00
>>>
>>> CASSA: 01
>>> 22-04-2017 10:55
>>> N.SCONTR.FISCALE 4
>>> t_fiscale 20170422 1826 *5*
>>> EURO
>>> SOLUZIONI LAC 23,00
>>> TOTALE EURO 23,00
>>> CONTANTE *23,00*
>>> C.F. *LMNOPQ89R01S234T*
>>>
>>> CASSA: 01
>>> 22-04-2017 18:26
>>> N.SCONTR.FISCALE 5
>>> t_non fiscale 20170422 1843 1
>>> NON FISCALE
>>> RAPPORTO REPARTI "Z"
>>> PERIODICO 1
>>> *(++ BELOW UNNECESSARY DATA ++)*
>>> DATA ULTIMO AZZERAMENTO
>>> 21-04-2017
>>>
>>> CASSA: 01
>>> 22-04-2017 18:43
>>> N.SCONTR.NON FISC 1
>>> NON FISCALE
>>> t_fiscale 20170422 1843 6
>>> RAPPORTO *Z*
>>> CHIUSURA FISCALE
>>> DATI IN EURO
>>>
>>> ------------------------
>>> CORRISPETTIVI
>>> SCONTRINI
>>> ------------------------
>>> CORRISP. GIORNALIERI
>>> 1 234,00
>>> PROGR. CORRISPETTIVI
>>> 123 456,78
>>> NOTE DI CREDITO GIORN.
>>> 0,00
>>>
>>> ------------------------
>>> CORRISPETTIVI
>>> DOCUMENTI CL.II
>>> ------------------------
>>> CORRISP. GIORNALIERI
>>> 0,00
>>> *FATTURE 0,00
>>> *RICEVUTE 0,00
>>> NOTE DI CREDITO GIORN.
>>> 0,00
>>>
>>> ------------------------
>>> DETTAGLIO
>>> OPERAZIONI
>>> ------------------------
>>> SCONTI 0,00
>>> N. 0
>>> MAGGIORAZ. 0,00
>>> N. 0
>>> BONIFICI 0,00
>>> N. 0
>>> RETTIFICHE 0,00
>>> N. 0
>>> CORRISP. NON RISCOSSI
>>> *SCONTRINI 0,00
>>> *RICEVUTE 0,00
>>> CORRISP. RISCOSSI
>>> *SCONTRINI 1 234,00
>>> *FATTURE 0,00
>>> *RICEVUTE 0,00
>>>
>>> ------------------------
>>> DOCUMENTI
>>> GIORNALIERI
>>> ------------------------
>>> N.SCONTR.FISCALI 6
>>> *N.SCONTR./NOTE CRED. 0
>>> N.SCONTR.N FISCALI 1
>>> *N.RAPP.LETTURE DGFE 0
>>>
>>> N.DOCUMENTI CL.II 0
>>> *N.FATTURE 0
>>> *N.FATTURE/NOTE CRED. 0
>>> *N.RICEVUTE 0
>>>
>>> ------------------------
>>> DATI GENERALI
>>> ------------------------
>>> N.LETT.MEM.FISCALE 0
>>>
>>> PROGR. AZZERAMENTI 960
>>> NUM. RIPRISTINI 0
>>>
>>> ------------------------
>>> DISPOS.GIORN.ELETTRONICO
>>> N.2 DEL 02-05-2014
>>> MATR. 05 30005163
>>>
>>> CASSA: 01
>>> 22-04-2017 18:43
>>> N.SCONTR.FISCALE 6
>>>
>>>
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.