How to capture values from a specific regex rowHow to capture values from a specific regex row

Hey guys.

I need to capture a specific one-line value in a pdf.

I’m trying via regex.

Can you help me?

the values ​​to be captured in this case would be the line containing the word “TEST”

However, I cannot default the word “TEST” as it is dynamic.

follow the pdf

Cliente Informações Montante (MWh)
DYSNEAY POPOJ Consumo                           1.438,082
Perdas (3,0%)                                43,142
Período de Suprimento PROINFA                                27,348
ago/21 Necessidade                           1.453,876

Contratos (Take %) Montante (MWh)
ABCDETAL (150%)                           1.445,964
TESTE                                   7,912
Total Contratos                           1.453,876

neste caso, preciso capturar apenas o valor da linha “TESTE”

image

Hi,

How about the following?

Sequence.xaml (7.4 KB)

Regards,

1 Like

Thanks for the answer.

however, as the text “TEST” is dynamic, for example, it can be “TEST”

On another occasion, the text may be “HOUSE”

On another occasion, the text may be “Mobile”

the default is the value after this text, which in the example is “TEST”

As I understand it in your logic, the text “TEST” is fixed, to work.

Hi,

Is there any rule to identify the target line? (for example, line just before Total etc)

Regards,

1 Like

Good !

the line could be, below

ABCDETAL (150%)                           1.445,964

and above

Total Contratos                           1.453,876

By default.

thanks for trying to help

Hi @Guilherme_Silva

Use Assign Activity

System.Text.RegularExpression.Regex.Match(Your Input variable,“\S+\n(?=Total)”).Tostring

You can Try with the below Regex condition

Hope it will work

Regards
Gokul

1 Like

Hi,

The following expression might be better.

System.Text.RegularExpressions.Regex.Match(yourString,".*(?=\r?\n\s*?Total)").Value

Regards,

1 Like

thanks guys, they both helped me !!

thank you very much

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.