Use regex.Match in subjet, Cannot be converted to string

I need help with this, my project has to read the subject of different emails from the same sender, but these emails somethings have missing parts in the subject, so I can´t use “split” because the position changes, I´m trying to use System.Text.RegularExpressions.Regex.Match(messages,“((?<=ODT:).*)”).ToString but cannot be converted to string.

The subject is:
change of status in ODT: GT-IM-18839 - DUCA: 251-9538546

In others emails, subject is:
change of status in ODT: GT-IM-18839 -

and in others emails, subject can be to:
change of status in DUCA: 251-9538546

I need to display in a messages box: ODT is: GT-IM-18839
and in another messages box: DUCA is: 251-9538546

Hi @mermonrroy

Please have a look below sample, you can switch the variable for currentSupplier with subject1, subject2 & subject3. it will check the keyword ODT/DUCA, use regex to find the information you need and display the message you wanted.
RegexMatchInSubjectProcess.zip (12.4 KB)

Cheers

1 Like

Hi! My apologize to answer you until today, I was trying to implement the solution that you gave me, but I cannot do it, I´ll upload my project so you can check it and give me some advice to how understand it. Thank you so much for your help. VISDOM1.xaml (14.5 KB)

regards.
Merari.

Hi @mermonrroy,

Sorry just get back to you now as I have been unwell.

VISDOM1_update.xaml (24.4 KB)

I have comment out the part you did and replace the prat I did, you might want to try run it and see if it works as I am unable to test it.

So what the process is now, after your if statement, check if the email address from contain your email address, assign mail.subject to currentSubject variable, then check the switch activity, the expression of switch statement means if the email subject contain both ODT and DUCA, assign to case ODT & DUCA, if subject contain ODT then assign to ODT and same for DUCA.

And in each case it will find the match ODT or DUCA value and output to the log message.

Give it a go and see if you got any other questions.

Cheers,

Allen

I hope your better now, thank you for your help! I try your solution and now it displays the information in the Output that I need. You´ve been so nice to me. Thank you for your support.

If I want to extract some information of the email body, is it in the same way? I just want to extract the Status in the email body, the robot has to read and extract the status, and this status it´s going to has many classification, so the robot has to qualify if the status meets the default status.

I hope you get well soon!

Best regards,

Merari

ccd

Hi @mermonrroy,
No worries, happy to help, and thank you, I am start feeling better. I enjoy helping and learning new ways of doing things from different scenarios, so feel free to ask me and will get back to you when I am available.

And regarding your question, the answer is yes, you can assign your email body information to a string variable first, then use Matches or Assign activity with regex to find the status value you are after.

If you are unsure how to get the status, feel free to send me message with sample email body and I will try provide you the regex.

Cheers,

Allen

1 Like

Hi @Allenliaw thank you so much for your time and your help, I will try your suggestion, and thanks again for your willingness to help me. Can I send you a direct messages or publish it directly here, If I feel unsure about the project?

Best regards.

Merari.

Hi @mermonrroy

No worries. Yes, you can send me direct messages, not 100% sure that I will be able to answer all questions but will do the best I can :slight_smile:.

Best regards,

Allen

1 Like

@Allenliaw Thank you! I will write to you

Best regards.

Merari

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