Printing Matches results of Regex

I am trying to extract a specific sentence from a string variable using Regex. I tried to print the result using “Log Message” out to check whether the matches result is correct. However, the output panel shows the following message:

System.Text.RegularExpressions.MatchCollection

Can anyone please tell me how to solve this issue? So much thanks to your help!

@Komom,

Use MatchesVariable(0).value to log first match.

Likewise you can log others by changing the index from 0 to 1,2…

My variable is Company_Nominal_Value, so does it mean I have to type Company_Nominal_Value(0).value to show the first match?

Yes, you got the logic correct.

@Komom,

If you want to log all in a single message box, use this in message.

String.Join(vbNewLine, Company_Nominal_Value.Select(Function (x) x.toString).toArray)

Thank you so much! I will try this out.

1 Like

@Komom

you can directly use without casting to array as well and better to sue value method

String.Join(Environment.NewLine, Company_Nominal_Value.Select(Function (x) x.Value))

cheers

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