NCC:01.08.026.001 / NSC: 140913;NSC: 141282;DOCUMENTO EMITIDO POR ME OU EPP OPTANTE PELO SIMPLES NACIONAL;; Voce pagou aproximadamente: R$ 4,24 de tributos federais R$ 11,22 de tributos estaduais Fonte: IBPT
Regex.
(?<=((NSC):))(.+?)(?=([\ |])|([;|]))
In this case, he finds both NSCs, but cuts into the “;” How to make it capture both numbers and save in different variables?
It is correct to have only one NSC, but some cases appear two and are not always next to each other. Can anyone give me a tip
Kindly try with this expression
so that we will be getting all the matches
(?<=NSC:).+?(?=([\ |])|([;|]))
–which we can store or call by using FOR EACH loop and then pass the above obtained variable as input and change the type argument as System.Text.RegularExpressions.Regex.Match