Issues to display regex in a message box

Hey, I would like to display a extracted word from a text in a box. So I used a for each loop and put the type of the used variable as System.Text.RegularExpressions.Matches. Its not working, what can I do else?

1 Like

before for each can you try this in the msg box

datum(0).tostring

2 Likes

Hi
it should be actually System.Text.RegulatExpressions.Regex.Match in the TYPE ARGUMENT in the FOR EACH activity

kindly change that and check once
or
it can be one more reason the matches expression might not give us any output
to check that use the same expression and input string here in this website regex101.com and there we can validate this

other than that everything looks perfect in this image / your sequence, like the way item variable called inside the for each loop is fine

hope this would help you
kindly try this and let know for any queries or clarification
Cheers @Ilga_Muller

1 Like

Hey @Sweety_Girl thanks for your help, it didn’t work with the msg box before each loop.

Thanks for your help @Palaniyappan, I couldnt find the type. I already checked the output with similar website, its correct. What package do I need to download?

Hello @Ilga_Muller
First check whether you are getting value from your regex pattern or not
Take a message box below Matches Activity and type this
String.Join(" ",datum) this will concatenate all the value which you get from matches activity make sure that its not empty

If it’s not blank and if you want the first word you can also use this
datum.First.ToString

1 Like

Thank you for helping me. Its empty. So I checked again if my regex is correct, and its still correct. Maybe my regex input in uipath is wrong?


I tried something new. So I ussed assign to convert the output in a string and this is what I’m getting:

How can I make it readable?

Hello @Ilga_Muller
You have to remove the Assign Activity above the message Box
You cannot directly convert an IEnumerable to String

Just run it without Assign and check if its working

1 Like

Hey @vickydas thank you, I tried and its not working. I checked the regex on regex101.com and its correct. How can I get a value from that match activity?

Hello @Ilga_Muller
Did you Remove the Assign Activity above the Message box in this image ??

Check this workflow once for better understanding
Regex_Practice.xaml (6.0 KB)

1 Like

Thank you @vickydas. Yes, I removed the Assign Activity and the msg box was still empty.

Where can I import or download “System.Text.RegularExpressions.Regex.Match”? I cant find it in the studio. I have only System.Text.RegularExpressions.Regex or
System.Text.RegularExpressions.Match.

I think I’m starting to understand the problem.
I checked the content of “lesbar” and its not what I was expecting.
“inhalt” is a variable of type “System.Net.Mail.MailMessage” and contains the body of the mail. In ForEach I’m trying to convert it to a string (“lesbar”) but I its not working. And it makes sence, as I saw the content of “lesbar”: Its the button of the msg box before “Ok”. How can I store the content of a mail body as a string and use that variable?

Servus @Ilga_Muller
for referencing try this
grafik

1 Like

Now I got it. Thank you guys for helping me to understand my problem.

For those who struggling with similar problems:
In my case I had a wrong input for my match activity. After converting the mail body in string variable ( with assing activity) it worekd.

@Ilga_Muller this sounds good :+1: Happy Automation

1 Like

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