Having trouble with Regex for Matches Activity

I’m trying to get a specific value from a text using lookbehind and lookahead.
My problem is that I’m not being able to come up with a pattern for lookahead part…

The value I want to find comes after the purple mark, “2.754,31”, the second one.
How should I find it?
image

The entire text:

DECLARO QUE RECEBI OS VOLUMES DESTE CONHECIMENTO EM PERFEITO ESTADO PELO QUE DOU POR CUMPRIDO O PRESENTE CONTRATO DE TRANSPORTE
NOME TÉRMINO DA PRESTAÇÃO - DATA/HORA CT-E OS
Nº Documento
RG INÍCIO DE PRESTAÇÃO - DATA/HORA 2.553
SÉRIE
ASSINATURA / CARIMBO 300

IDENTIFICAÇÃO DO EMITENTE
PROTEGE S/A PROT. E TRANSPORTE DACTE-OS MODAL
DE VALORES Documento Auxiliar de Conhecimento de RODOVIÁRIO
CNPJ: 43.035.146/0070-07 Transporte Eletrônico para Outros Serviços
IE: 90.828.657.02
Rua Campos Salles, 39
Parque São Paulo
85.803-560 - Cascavel - PR MODELO SÉRIE NÚMERO Data e Hora Emissão Insc. Suframa Dest.
67 300 2.553 31/03/2021 15:40:50

TIPO DO CT-E

CT-e Normal
Chave de Acesso
4121 0343 0351 4600 7007 6730 0000 0025 5315 0302 8074
TIPO DO SERVIÇO

Transporte de Valores Consulta em http://www.cte.fazenda.gov.br/portal

Código Fiscal de Operações e Prestação - Nat. da Operação Protocolo de Autorização de Uso
5357 - Prestacao de servico 141210045466794 - 01/04/2021 16:40:51
INÍCIO DA PRESTAÇÃO PERCURSO DO VEÍCULO TÉRMINO DA PRESTAÇÃO
PR - CEU AZUL PR - 4104808 - CASCAVEL

TOMADOR DO SERVIÇO: COOP DE CRED DE LIVRE ADM CATA MUNICÍPIO: CEU AZUL CEP: 85.840-000
ENDEREÇO: RUA CURITIBA, 1390 - - CENTRO UF: PR PAÍS: BRASIL
CPF / CNPJ: 78.414.067/0007-55 Insc. Estadual: Fone:
INFORMAÇÕES DA PRESTAÇÃO DO SERVIÇO
QUANTIDADE DESCRIÇÃO DO SERVIÇO PRESTADO
0 Transporte de Valores

COMPONENTES DO VALOR DA PRESTAÇÃO DE SERVIÇO
NOME VALOR NOME VALOR NOME VALOR NOME VALOR VALOR TOTAL DO SERVIÇO
2.754,31
VALOR A RECEBER
2.754,31
INFORMAÇÕES RELATIVAS AO IMPOSTO
CLASSIFICAÇÃO TRIBUTÁRIA DO SERVIÇO BASE DE CÁLCULO ALÍQUOTA ICMS VALOR ICMS % RED.BC.CALC.
00 - Tributação normal do ICMS 2.754,31 12,00 330,52
OBSERVAÇÕES
Servicos de transporte de valores Vencimento da Fatura 12/04/2021; SUJEITO A RETENCAO DE 1,0% IRRF,ARTIGO 55, LEI 7713
DE 22/12/1988 - R$ 27,54; RETENCAO PARA SEGURIDADE SOCIAL - INSS: 302,97 ; PIS: 17,90 ; COFINS: 82,63 ; CSLL: 27,54 ; Sujeito
a retencao de 4,65% de PIS/COFINS/CSLL conforme Lei 10.833/2003 art. 30 e Lei 13.137/2015 art. 24
SEGURO DA VIAGEM
RESPONSÁVEL NOME DA SEGURADORA NÚMERO DA APÓLICE

INFORMAÇÕES ESPECÍFICAS DO MODAL RODOVIÁRIO
TERMO DE AUTORIZAÇÃO DE FRETAMENTO NÚMERO DE REGISTRO ESTADUAL PLACA DO VEÍCULO RENAVAM DO VEÍCULO CPF / CNPJ:

USO EXCLUSIVO DO EMISSOR DO CT-E RESERVADO AO FISCO

CT-e OS gerada com tecnologia NF-e Security® da Benefix - http://www.webenefix.com.br"

The value cope after VALOR A RECEBER this text and before INFORMAÇÕES RELATIVAS AO IMPOSTO this text?

1 Like

Yes, exactly.

@Gabriel_Wisniewski - Please try this…

image

Regex Pattern = (?<=VALOR A RECEBER.+\r?\n)[\d\.,]+
1 Like

Sorry for the late answer, but I can’t get it work, i’m copying and pasting and somehow it can’t find the desired value.

image

I don’t understand why.

@Gabriel_Wisniewski - If you trying Regex101…make sure you select ECMA script on the left…

That’s why I always try my Regex patterns in Regex storm tester which compatible with Uipath since it was built using .NET.

1 Like

Thanks for the recomendation, works better than the ones I was using, it’s working great in the automation. Thank you!

1 Like

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