Help with Regex Vat Code

Hello Everybody,
i need to extract the vat code from this string

DATI ANAGRAFICI 1 2 3
03922680164 SDGDRG SRL
DATI RELATIVI Comune Prov. Cap Indirizzo
AL DATORE DI LAVORO, 4 5 6 7
ENTE PENSIONISTICO dgferger BG 24126 VIA fddsfd 87
O ALTRO SOSTITUTO

  • Via FDFa, 31 - 10093 C - Conforme al Provvedimento del 15/01/2021
    D’IMPOSTA Telefono, fax Indirizzo di posta elettronica Codice attività Codice sede
    8 prefisso numero 9 10 11

DATI RELATIVI Codice fiscale Cognome o Denominazione Nome
AL DIPENDENTE, 1 2 3
PENSIONATO O 03695730162 STUDIO FDSFDS TRETER
ALTRO PERCETTORE Sesso Provincia Categorie Eventi Casi di esclusione

My goal is to retrieve the number in bold
How can i do?
Regex is the solution?

Thanks a lot
Loris

Hi

Use this Regex expression in a assign activity or

In MATCHES activity

(\d){11}

If it’s a assign activity

Out_matches = System.Text.RegularExpressions.Regex.Matches(strinput.ToString, “(\d){11}”)

Where out_matches is a varivale of type
system.Collections.Generic.List(System.Text.RegularExpressions.Regex.Match)

For referral

This will fetch you those values as a list

Cheers @l.sambinelli

HI @l.sambinelli

Use Assign activity

LSH → create an variable
RHS → System.Text.RegularExpressions.Regex.Match(Inputstring,“\d{11}”).Tostring.Trim

Regards
Gokul

Hi,

I suppose Vat code is not always 11 digits number?

If there is possibility the first 2 digits is Alphabet, the following pattern will work.

System.Text.RegularExpressions.Regex.Matches(yourString,"\b[A-Z\d]{2}\d{9}\b")

Main.xaml (7.4 KB)

If the number of digits varies, change pattern as its range like {7,9}.

Regards,