How to find specific value between 2 specific texts?

I’m new to UiPath and regex.

I need to use a regex to find this number, I wanted to get it by findind whatever is between the two phrases (the text is loaded from PDF).

Quantidade Valor Valor do Documento
5.318,64
INSTRUÇÕES DE RESPONSABILIDADE DO BENEFICIÁRIO. QUALQUER DÚVIDA SOBRE ESTE BOLETO, CONTATE O BENEFICIÁRIO

If anyone can help me I’d really apreciate it.

@Gabriel_Wisniewski - Is the “Quantidade Valor Valor do Documento” and/or “INSTRUÇÕES DE RESPONSABILIDADE” always remains same?? if yes then we can fetch the #

Like this…

Or like this…

1 Like

Hi @Gabriel_Wisniewski
First use matches activity give your input and pattern as Documento\s*[\d .,]\sINSTRUÇÕES
In second matches activity give pattern as "[\d .,]*"

image

image

First Regex pattern

image

1 Like

Sorry guys, I checked the output of the Read PDF Text activity and I realised it was different from how I originally selected it (dumb mistake)

Valor do Documento
00 R$ 5.318,64

INSTRUÇÕES DE RESPONSABILIDADE DO BENEFICIÁRIO.

This is how the text is now, and the “$” character is making it difficult for me to write the regex now.

Hi @Gabriel_Wisniewski

As said earlier use this in the first match activity Documento[\w$\d\s .,]*INSTRUÇÕES

In the second Match activity use [\d .,]*

1 Like

The only value that I need to get is the R$ 5.318,64 part

Please try this pattern…

or if you want R$ 5.318,64

1 Like

Please find the starter help here…

StrMatches is of variable type MatchCollection

Here StrInput is
image

1 Like

image
I really don’t get what I’m doing wrong

@Gabriel_Wisniewski - Please check this Link…You have choose ECMA Script on Regex101 website…

Link for RegexTestter…

Note: Personally I prefer/use mostly RegexTester which is Nice for testing regular expressions in .NET (which is what UiPath is using)

1 Like

Thank you, I can only assume I was typing it wrong all this time.

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