REgex Problem Expression

Hello,

I have a problem with regular expression. (? <= NSC). + [0-9]
Although I entered [0-9] he is returning part of the sentence after NSC

text
Val aproximado dos tributos: R$ 26,73 ( Fonte IBPT ) COMPL END:SALA 267 - DISTRITO SOUSAS CLARI JULIANE PIETSCH ORC 52783 ORDEM DE COMPRA: 0209023029 - NSC 16092 *** UNIDADEUNIDADE UNIDADE *** DADOS P/ DEPOSITO: B Documento emitido por ME ou EPP optante pelo simples nacional, nao gera direito a credito fiscal ICMS, ISS e IPI conf. lei complementar 123/2006

expression
(?<=NSC).+[0-9]

Returne
16092 *** UNIDADEUNIDADE UNIDADE *** DADOS P/ DEPOSITO: B Documento emitido por ME ou EPP optante pelo simples nacional, nao gera direito a credito fiscal ICMS, ISS e IPI conf. lei complementar 123/2006

Correct
16092

Can someone help me

1 Like

Hi
use the expression like this
(?<=NSC).[0-9]+

Cheers @KMota

1 Like

Hi @Palaniyappan

It still returns everything after the number 16092

Hmm…its working for me
image

and i used this expression in studio as well along the writeline activity
System.Text.RegularExpressions.Regex.Match(str.ToString,“(?<=NSC).[0-9]+”).ToString

where i stored this text in a txt file and used like this

Cheers @KMota

1 Like

that’s weird

Look

image

image

:sweat_smile:

bugged :grimacing:

I have a REgex set, because that value appears accurately in many different ways

Is that the problem

1 Like

hmm…yah
but did we try with normal expression without regex builder
@KMota

Wow
I inserted a | after is it worked

:sweat_smile:

let’s continue testing lol

thanks again @Palaniyappan

But | symbol is like OR operator…
hmm…strange
@KMota

1 Like

yeah, really weird. I celebrated ahead of time, it didn’t work lol … I don’t know where else to go.
I’ll post some examples of texts that I need to remove the NSC

NCC: 02.07.046.001 NSC: 16.2587

VENDEDOR DANILO - NRO. PED INTERNO 1581932 - RETIRADO POR FRANCIS REENDERECO COBRANCA RUA A******1 VILLE SAINTE HELE CAMPINAS SP 1 VALOR TRIBUTOS FEDERAL R ********VALOR TRIBUTOS ESTADUAL R *******PEDIDO NCC 0202028002 NSC 166415

Val aproximado dos tributos: R$ 26,73 ( Fonte IBPT ) COMPL END:****** - DISTRITO SOUSAS CCH ORC 52783 ORDEM DE COMPRA: 0209023029 - NSC 16092 *** UNIDADE AIRON MONTAIN TATUQUARA *** DADOS P/ DEPOSITO: BANCO*********Documento emitido por ME ou EPP optante pelo simples nacional, nao gera direito a credito fiscal ICMS, ISS e IPI conf. lei complementar 123/2006

NCC 0209028013|NSC 165028|Voce pagou aproximadamente: |R$ 27,22 de tributos federais|R$ 52,20 de tributos estaduais|Fonte: IBPT/empresometro.com.br 0C3829

PEDIDO AUTORIZADO POR Caroline Buchling NCC 0209028014 NSC 166256 Forma(s) de pagamento: Boleto Bancario: 437.34

In RegEx Builder When I insert these texts it returns the correct values, but when I run the project the variable returns null

i didnt get this buddy
have we used another expression to get different output
@KMota

1 Like

You can use this in advanced expression:
(NSC \s*(\d+)\s*\*\*\*)
But you will need to access the groups to get just the number:
matches.FirstOrDefault().Groups(2)