Finding patterns in text using regex

I need some help
trying to use "Finding patterns in text using regex" and "Using Structured Data from the Clipboard" and offcourse im doing something wronge.

I dont need a form paragraph, i want to change that formula to clipboard too. But i was thinking it going to be easy to start pasting in that feild manually the format that i need to copy.

I want to set this information in the "Data Blaze Fac" formtoggle in the bottom.

{formparagraph: cols=60; rows=8; name=text; default=\n

Santiago, 08 mayo 2023

Ref.: Cotización NT Nº A_08_05

Nombre cliente:
Isabel Garcia

Nombre empresa:
puma

Email:
isabel.garcia@puma.com

Presente

Estimada/o:
Isabel Garcia

Agradecemos a usted el haber considerado a HOTEL BIDASOA, para su evento, para lo cual, y de acuerdo con lo solicitado, tenemos el agrado de enviar la siguiente cotización por los servicios requeridos:

Salón Araucaria

Fecha

miércoles,17/05/2023

Horario
08:30-19:00
hrs

Número de personas
: 08

Montaje
“Directorio”

Valor Arriendo Salón
: $280.000

  • IVA

Opción Coffee B
: $8.900

  • IVA

Vaso de Frutas
: $2.900

  • IVA

Menú B
: $33.000

  • IVA
    13:15 hrs

Opción Coffee A
: $5.900

  • IVA

Porción frutos secos
: $3.900

  • IVA

Estacionamiento adicional
: $6.723

  • IVA

Estacionamiento**
02 LIBERADOS

Valores Netos
/Unitarios

Cantidad
Valores Totales/
IVA incluido

Salón Araucaria
: $280.000

  • IVA
    1
    $333.200
    Opción Coffee B
    : $8.900
  • IVA p/p
    8
    $84.728
    Vaso de fruta
    : $2.900
  • IVA p/p
    8
    $27.608
    Menú B
    : $33.000
  • IVA p/p
    8
    $314.160
    Opción Coffee A
    : $5.900
  • IVA p/p
    8
    $56.168
    Porción frutos secos
    : $3.900
  • IVA p/p
    8
    $37.128
    Estacionamiento adicional
    : $6.723
  • IVA p/p
    04
    $32.000
    10% de Cargo por servicio (Pago directo, no facturable)

$51.979

Valor total jornada

=$936.971

50% Total Garantía*

=$468.486

\n}

{Folio=extractregex(text, "Ref.: Cotización NT Nº: (.+)")}
{Email=extractregex(text, "Email:(.+)")}
{Nombre empresa=extractregex(text, "Nombre empresa: (.+)")}
{Salón=extractregex(text, "Salón
: (.+)")}
{Fecha=extractregex(text, "Fecha: (.+)")}
{Valor total jornada=extractregex(text, "Valor total jornada:
(.+)")}

{formtoggle: name=Data Blaze Fac; default=yes}
{formtext: name=Folio}
{formtext: name=Email}
{formtext: name=Nombre empresa}
{formtext: name=Salón}
{formtext: name=Fecha}
{formtext: name=Valor total jornada}{endformtoggle}

Hey @Nikolas_Torres_Niko , welcome back with more tough regex questions :slight_smile:

I think that this is what you're trying to get to. Your regex patterns were missing some \n in spots to indicate new lines. I updated those so that, at least in your example, each one of your variables is finding a match.

{formparagraph: cols=60; rows=8; name=text; default=\n
Santiago, 08 mayo 2023
Ref.: Cotización NT Nº A_08_05
Nombre cliente:
Isabel Garcia
Nombre empresa:
puma
Email:
isabel.garcia@puma.com
Presente
Estimada/o:
Isabel Garcia
Agradecemos a usted el haber considerado a HOTEL BIDASOA, para su evento, para lo cual, y de acuerdo con lo solicitado, tenemos el agrado de enviar la siguiente cotización por los servicios requeridos:
Salón Araucaria
Fecha
miércoles,17/05/2023
Horario
08:30-19:00
hrs
Número de personas
: 08
Montaje
“Directorio”
Valor Arriendo Salón
: $280.000
IVA
Opción Coffee B
: $8.900
IVA
Vaso de Frutas
: $2.900
IVA
Menú B
: $33.000
IVA
13:15 hrs
Opción Coffee A
: $5.900
IVA
Porción frutos secos
: $3.900
IVA
Estacionamiento adicional
: $6.723
IVA
Estacionamiento**
02 LIBERADOS
Valores Netos
/Unitarios
Cantidad
Valores Totales/
IVA incluido
Salón Araucaria
: $280.000
IVA
1
$333.200
Opción Coffee B
: $8.900
IVA p/p
8
$84.728
Vaso de fruta
: $2.900
IVA p/p
8
$27.608
Menú B
: $33.000
IVA p/p
8
$314.160
Opción Coffee A
: $5.900
IVA p/p
8
$56.168
Porción frutos secos
: $3.900
IVA p/p
8
$37.128
Estacionamiento adicional
: $6.723
IVA p/p
04
$32.000
10% de Cargo por servicio (Pago directo, no facturable)
$51.979
Valor total jornada
=$936.971
50% Total Garantía*
=$468.486
\n}
{Folio=extractregex(text, "Ref.: Cotización NT Nº (.+)")}
{Email=extractregex(text, "Email:\n(.+)")}
{`Nombre empresa`=extractregex(text, "Nombre empresa:\n(.+)")}
{`Salón`=extractregex(text, "Salón
: (.+)")}
{Fecha=extractregex(text, "Fecha\n(.+)")}
{`Valor total jornada`=extractregex(text, "Valor total jornada\n=(.+)")}
{formtoggle: name=Data Blaze Fac; default=yes}
{formtext: name=Folio}
{formtext: name=Email}
{formtext: name=Nombre empresa}
{formtext: name=Salón}
{formtext: name=Fecha}
{formtext: name=Valor total jornada}{endformtoggle}

Let me know if these needs any more fine-tuning.

Thanks you so much!
Regex! its my Headache.

"I want to do it directly from the clipboard. But I noticed that in your 'formparagraph' there are no spaces, but when I copy and paste it generates spaces that make it impossible to detect or use regex correctly.

"And the fourth question for 'salón' is detecting example b), but I need it to detect example a)."

A)
...servicios requeridos:
Salón Araucaria
Fecha...

B)
but is detecting
Valor Arriendo Salón
: $280.000

I changed the formparagraph field to a clipboard command and then I used the doc you linked to copy to my clipboard the second page, from "Santiago, 08 mayo 2023" through "=$468.486".

That worked for me! This version did not update the request for the change to Salón. I'm not sure what text you want to pull in when selecting exactly for that portion. is it just that text?

{text={clipboard}}
{Folio=extractregex(text, "Ref.: Cotización NT Nº (.+)")}
{Email=extractregex(text, "Email:\n(.+)")}
{`Nombre empresa`=extractregex(text, "Nombre empresa:\n(.+)")}
{`Salón`=extractregex(text, "Salón Araucaria\n(.+)")}
{Fecha=extractregex(text, "Fecha\n\n\n(.+)")}
{`Valor total jornada`=extractregex(text, "Valor total jornada\n\n\n\n\n\n\n\n=(.+)")}
{formtoggle: name=Data Blaze Fac; default=yes}
{formtext: name=Folio}
{formtext: name=Email}
{formtext: name=Nombre empresa}
{formtext: name=Salón}
{formtext: name=Fecha}
{formtext: name=Valor total jornada}{endformtoggle}

Hi! I made some changes but it works almost perfectly. I have two questions, previously I added "/r" for it to work with Windows and it worked, but not for all fields.

"This works perfectly with Chrome OS, it's just that the 'Valor total joranda' has a currency money format that DataBlaze does not recognize with the function "Inserte Row Table".

{text={clipboard}}
{Folio=extractregex(text, "Ref.: Cotización NT Nº (.+)")}
{Email=extractregex(text, "Email:\n(.+)")}
{Nombre empresa=extractregex(text, "Nombre empresa:\n(.+)")}
{Salón=extractregex(text, "Salón\n(.+)")}
{Fecha=extractregex(text, "Fecha\n\n\n(.+)")}
{Valor total jornada=extractregex(text, "Valor total jornada\n\n\n\n\n\n\n\n=(.+)"); format=,.0f}
{formtoggle: name=Data Blaze Fac; default=yes}
{formtext: name=Folio}
{formtext: name=Email}
{formtext: name=Nombre empresa}
{formtext: name=Salón}
{formtext: name=Fecha}
{formtext: name=Valor total jornada}{endformtoggle}

{dbinsert: INSERT INTO Cuentas A SET folio=@folio, email=@email, Empresa=@nombre empresa, salón=@salón, fecha=@fecha, valor total jornada=@valor total jornada; space=1Kjyt0j9LqaI9YHzH5jHCP; autoaddfields=yes}

This is the windows format, but "fecha/date" and "valor de joranda" (money format)

{text={clipboard}}
{Folio=extractregex(text, "Ref.: Cotización NT Nº (.+)")}
{Email=extractregex(text, "Email:\r\n(.+)")}
{Nombre empresa=extractregex(text, "Nombre empresa:\r\n(.+)")}
{Salón=extractregex(text, "Salón\r\n(.+)")}
{Fecha=extractregex(text, "Fecha\r\n\n\n(.+)")}
{Valor total jornada=extractregex(text, "Valor total jornada\r\n\n\n\n\n\n\n\n=(.+)"); format=,.0f}
{formtoggle: name=Data Blaze Fac; default=yes}
{formtext: name=Folio}
{formtext: name=Email}
{formtext: name=Nombre empresa}
{formtext: name=Salón}
{formtext: name=Fecha}
{formtext: name=Valor total jornada}{endformtoggle}

{dbinsert: INSERT INTO Cuentas A SET folio=@folio, email=@email, Empresa=@nombre empresa, salón=@salón, fecha=@fecha, valor total jornada=@valor total jornada; space=1Kjyt0j9LqaI9YHzH5jHCP; autoaddfields=yes}

"Thanks for everything."

What type of field is Fecha in Data Blaze? If it's not accepting certain data, it's likely a mismatch between the type of field and how you're writing it in.

I created a test snippet that wrote a number ({number=123.45; format=,.0f}) into Data Blaze with that formatting and it worked OK writing into Data Blaze in both number and short text fields.

With Chrome OS i dont have problems with the date, because is "long text" field format. I dont know how to match the format of "date" of data blaze. Same thing with "valor total joranda" If I needed to perform a calculation later on (which I don't know how to do) between the sheets or books of data blaze.

This is the document from which I extract the information.https://docs.google.com/document/d/142mG34Vb11lXEMCdtskPjmb5Nj5VefN7mQ6RtnAdF4g/edit?usp=sharing

image

Screenshot 2023-05-19 13.48.49

[Error - The "format" setting can only be used for numbers]

CI_15_05
Silvia.Bermudez@ausenco.com
ausenco
Ciprés
martes,23/05/2023
$1.395.692

Perhaps, just like in a regular data table, is there a way to have a column without a specific format but give it a currency format in a separate column to avoid issues with formulas? I have done this in Sheets or Excel but i dont know if it is posibble en data blaze

With Windows, I made the following modification that partially worked.

image

add \r basically in the same format or a similar format.

However, in the fields of date and total working hours, the information is not being detected.

I need to understand if I can perform calculations in Data Blaze or if I do them in Text Blaze using the information from Data Blaze.

Thank you very much as always! You are incredible.

The error with Valor total jornada and using the format is because your document uses the period as the thousands separator, and that makes Text Blaze not recognize it as a number.

In your example, the value the regex is retrieving is "$1.395.692". Because the character that separates the 1 and the 3 is . and not , it's causing us to not recognize it as a number, and thus you cannot use the format= setting on it. I think there's a way to replace only that first period with a comma using regex, but I personally do not have the regex skills to do that :frowning: hopefully one of our other teammates can chime in about it.

For the issue with Fecha, to write a date into Data Blaze, the date must be in the format of YYYY-MM-DD. The date that's being parsed by the regex in your example doc is "martes,23/05/2023". If I update the Fecha regex to the following, it captures only the "23/05/2023" portion of it: {Fecha=extractregex(text, "Fecha\n\n\n\w+,(.+)")}

To write that into Data Blaze, you could do: {fecha_for_datablaze={time: YYYY-MM-DD; at={=Fecha}; pattern=DD/MM/YYYY}} and then write the fecha_for_datablaze variable into Data Blaze instead of just Fecha

This is very complicated so let me know if that's not clear!