Hi there,
I’m currently having issues extracting multi-line text from an email body, after a key word (including that key word).
E.g, my email looks like so:
Client No: 1234
Client Name: Mr Smith
Client Response: ---------
Hello Mr A,
Please find your info below
Many thanks,
Mr Smith
How would I be able to extract everything from “Client Response:” to the very end of the email using regex? I have already used an assign activity to get my email body into a string variable (named MailMessageBody), but aren’t sure how best to use regex to pull info across multiple lines.
Thanks in advance!
vrdabberu
(Varunraj Dabberu)
January 23, 2024, 4:59pm
2
Hi @sam.willson
Use the for each and pass the currentmail.body and save that in a variable.
use the regex as below:
((Client Response[\s\S]*))
System.Text.RegularExpressions.Regex.Match(Variable,"((Client Response[\s\S]*))").Value
Regards
lrtetala
(Lakshman Reddy)
January 23, 2024, 4:59pm
3
Hi @sam.willson
Please try this
(?=Client Response:).*[\s\S]*
System.Text.RegularExpressions.Regex.Match(Input,"(?=Client Response:).*[\s\S]*").Value
Regards,
mkankatala
(Mahesh Kankatala)
January 23, 2024, 4:59pm
4
Hi @sam.willson
You can use the below regex
Hope it helps!!
Anil_G
(Anil Gorthi)
January 23, 2024, 5:02pm
5
@sam.willson
If that is the need then you dont need a regex also…
You can use str.Split({"Client Response:"},StringSplitOptions.None).Last
Cheers
1 Like
Thank you for this, that’s worked perfectly! Appreciate the really quick response
1 Like
lrtetala
(Lakshman Reddy)
January 23, 2024, 5:16pm
7
@sam.willson
Please mark the appropriate post as solution
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
1 Like
system
(system)
Closed
January 26, 2024, 5:17pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.