I'm new to UiPath, can't get a regex to work

I’m trying to extract data from a PDF to Excel, simple enough, but when using Matches to find a regular expression I can’t get a argument that can find a specific number.

The 74891. part is always gonna be the same, so it could be used as prefix, I just can’t get it to work. If anybody could help i’d be thankful.

Hi @Gabriel_Wisniewski

You want to extract all the numbers after 74891.?

1 Like

yes, the whole 74891.12123 00578.530222 03023.831096 1 85780000531864

Hi, try this:

output = System.Text.RegularExpressions.Regex.Match(your_String,"^74891.+$").Value

Link: regex101: build, test, and debug regex
image

1 Like

Try this

^74891.[\d .]*

1 Like

@Gabriel_Wisniewski - If your barcode doesn’t always starts with 748 but the pattern is same for others, you can try the below…

1 Like

for some reason none seem to work, the entire text in the file is this:

748-X Comprovante de Entrega
Beneficiário
SPSP - SISTEMA DE PRESTACAO DE SEGURANCA PATRIMONIAL LTDA - 04.346.665/0001-02
Agência/Código Beneficiário
3022.03.02383
Nro.Documento
000016206
Pagador
COOPERATIVA DE CREDITO E INVESTIMENTO DE LIVRE ADMISSAO VANGUARDA DA REGIAO DAS (002001)
Vencimento
02/04/2021
Valor do Documento
5.318,64
Recebi(emos) o bloqueto/título
com as características acima.
Data Assinatura
Data Entregador
( )Mudou-se
( )Ausente
( )Não existe nº indicado
( )Recusado
( )Não procurado
( )Endereço insuficiente
( )Desconhecido
( )Falecido
( )Outros(anotar no verso)
748-X Recibo do Pagador
Local de Pagamento
PAGÁVEL PREFERENCIALMENTE NAS COOPERATIVAS DE CRÉDITO DO SICREDI
Vencimento
02/04/2021
Beneficiário
SPSP - SISTEMA DE PRESTACAO DE SEGURANCA PATRIMONIAL LTDA - 04.346.665/0001-02
Agência/Código Beneficiário
3022.03.02383
Data do Documento
12/03/2021
Nro.Documento
000016206
Espécie Doc.
DM
Aceite
N
Data do Processamento
12/03/2021
Nosso Número
21200578-5
Uso do Banco Carteira
00
Espécie
R$
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 (-)Desconto/Abatimento
(-)Outras Deduções
(+)Mora/Multa
(+)Outros Acréscimos
(=)Valor Cobrado
Pagador
COOPERATIVA DE CREDITO E INVESTIMENTO DE LIVRE ADMISSAO VANGUARDA DA REGIAO DAS (002001) CNPJ: 78.414.067/0064-43
R SETE DE SETEMBRO 556
12120-000 TREMEMBE SP
Pagador/Avalista
Autenticação Mecânica -
748-X 74891.12123 00578.530222 03023.831096 1 85780000531864
Local de Pagamento
PAGÁVEL PREFERENCIALMENTE NAS COOPERATIVAS DE CRÉDITO DO SICREDI
Vencimento
02/04/2021
Beneficiário
SPSP - SISTEMA DE PRESTACAO DE SEGURANCA PATRIMONIAL LTDA - 04.346.665/0001-02
Agência/Código Beneficiário
3022.03.02383
Data do Documento
12/03/2021
Nro.Documento
000016206
Espécie Doc.
DM
Aceite
N
Data do Processamento
12/03/2021
Nosso Número
21200578-5
Uso do Banco Carteira
00
Espécie
R$
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
NFS-e : 15420
(-)Desconto/Abatimento
(-)Outras Deduções
(+)Mora/Multa
(+)Outros Acréscimos
(=)Valor Cobrado
Pagador
COOPERATIVA DE CREDITO E INVESTIMENTO DE LIVRE ADMISSAO VANGUARDA DA REGIAO DAS (002001) CNPJ: 78.414.067/0064-43
R SETE DE SETEMBRO 556
12120-000 TREMEMBE SP
Pagador/Avalista
Autenticação Mecânica - Ficha de Compensação

Try this [\d.]* It will extract all the numbers along with dot character

1 Like

If I try the number alone it works, but with the rest of the text in the PDF it can’t find anything.

For me it extracting all the numbers even if text is there

Or try this 74891[\d .]*

1 Like

I can see, it is pulling the barcode correctly…

1 Like

thank you, it worked

1 Like

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