Komom
(Komom)
September 30, 2024, 9:47am
1
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!
ashokkarale
(Ashok Karale)
September 30, 2024, 9:54am
2
@Komom ,
Use MatchesVariable(0).value
to log first match.
Likewise you can log others by changing the index from 0 to 1,2…
Komom
(Komom)
September 30, 2024, 9:59am
3
My variable is Company_Nominal_Value, so does it mean I have to type Company_Nominal_Value(0).value to show the first match?
ashokkarale
(Ashok Karale)
September 30, 2024, 10:12am
4
Yes, you got the logic correct.
ashokkarale
(Ashok Karale)
September 30, 2024, 10:21am
5
@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)
Komom
(Komom)
September 30, 2024, 10:38am
6
Thank you so much! I will try this out.
1 Like
Anil_G
(Anil Gorthi)
September 30, 2024, 12:35pm
7
@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
system
(system)
Closed
October 3, 2024, 12:36pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.