I want to extract the ticket reference number from this email. How do I filter the email body
Are you able to get email body through mail message right?
Hi @Tengku_Aliff, welcome to the Community.
You can simple read the email body & use the following RegEx pattern to extract the desired data:
Ticket ref: (\w+\d+)
The corresponding UiPath Syntax will be:
System.Text.RegularExpressions.Regex.Match(emailBodyString,”Ticket ref: (\w+\d+)”).ToString
Hope this helps,
Best Regards.emphasized text
yes i am able to do just that. its the filtering function that i am having trouble with
thats great thank you! i will try and use regex for the filtering.
btw, is there any other method other than using regex? like in power automate you can use method like split, trim and skip in filtering. i wonder if you can use it in UiPath
- Use get outlook mail messages and read the email with the subject you have and want to read.
- Use For each activity and save the mail body in txt document.
- Read the text file and use find Matching Patterns activity and use regular expression to get ticket ref no as below:
4. save the output and use for each activity and print using an log message. If you have further process you can perform that.
Note: Attached the entire workflow for reference. Attached both Regex process and split method process in the same zip file. Please Check.
Email.zip (157.7 KB)
Hope it helps!!
If there are no content present after Ticket ref: SRF0003779795, you can simply manipulate the string & use the following function:
emailBodyString.Split(“Ticket ref: ”)(1).ToString.Trim
This will split the string based on Ticket ref: keyword & return the
SRF0003779795 part as the output.
Hope this helps,
If you find solution for the query mark it and close the loop
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.