Concatenate two matches using regex

Does anyone know hot to concatenate two string matches using Regex?

Input text is "Id klijenta: 963258 Naziv: ADDIKO BANK Adresa: SLAVONSKA Zagreb

OIB: Matični broj: 5241258 Broj osobne: - Identifikacijski broj:" , and I have to get output "ADDIKO BANK, 963258"


Use this expression in a assign activity like this if your input is stored in a variable named str_input

Str_output = System.Text.RegularExpressions.Regex.Match(str_input.ToString,”(?<=Naziv:).+(?=Ad)”).ToString.Trim+” : “+ System.Text.RegularExpressions.Regex.Match(str_input.ToString,”(?<=klijenta:).+(?=Naziv)”).ToString.Trim

Cheers @Olivera_Kalinic


I have to use Matches activity because input String has many matches like the one I explained before. It works when I extract, for example, “(?<=Naziv: ).*(?= Adresa)” or “(?<=Id klijenta: ).*(?= Naziv)”, but I have to concatenate these two values. The same thing is with all other matches that are found inside input string.

Result is array of found strings. In this moment it is just array of “(?<=Naziv: ).*(?= Adresa)”, but I have to get array of string1 + ", " + string2


Hope the following helps you.

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"(?<=Id klijenta:\s)(?<Idklijenta>\d+)(\sNaziv:\s)(?<Naziv>.+?)(?=\sAdresa:)")

resultArray = mc.Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Groups("Naziv").Value+", "+m.Groups("Idklijenta").Value).ToArray (2.6 KB)