Hi I need to read data from Email, I dont know how to create regex. I have something like:
System.Text.RegularExpressions.Regex.Match(EmailBody,β(?<=QuoteNumber).+β).Value
and it works for only for th first row:
Email:
QuoteNumber : 123
SAP ID of Account : 123
SAP ID of Channel Partner : 123
SAP ID of Sold To : 123
How to make it work for other rows as well?
ppr
(Peter Preuss)
August 10, 2021, 2:16pm
2
when anchoring to a particular value like:
then sure it is working only for this anchor
when making it generic to all values after : then it looks like this:
But if the field info is needed we need more extraction info. e.g. like:
and consult the groups:
also have a look here:
Yee but then I need to use Matches and then assign. If I want to use only assign in multiple assign how to create such regex?
System.Text.RegularExpressions.Regex.Match(EmailBody,β(?<=SAP ID of Account : ).+β).Value
doesnt work
ppr
(Peter Preuss)
August 10, 2021, 2:41pm
4
Regex Megapost and referenced learning resources are very recommended it newe/newr to regex
We use matches if we expect also mutliple hits within the text
here we are looking for a single digit and got 3 hits
We use Match if we are expecting /are interested on only max 1 hit:
So it depneds on your strategy wehen to use match or matches
Kindly note: when importin following we can reduce the statement as seen in imediate boxes above:
Yes sure, but in this page it looks like it should be working:
ppr
(Peter Preuss)
August 10, 2021, 2:48pm
6
not sure If I got the questions
Match is 123, SAP ID of Account is Anchor and therefore not part of the match
ok, that is right but I mean that regex in Uipath returns me QuoteNumber as well.
In my example they are all 123 but I want to get the value from SAP ID of Account, not from the first one.
Iβm just kindly asking You to help me fixing this regex
I have sth like this
ppr
(Peter Preuss)
August 10, 2021, 3:00pm
8
we cant see the implementation details. e.g. Regex Patterns. Please share all infos with us. thanks
OK, I have such email body and I need to read 4 variables from it
"QuoteNumber : 123
SAP ID of Account : 345
SAP ID of Channel Partner : 567
SAP ID of Sold To : 897"
For that I use multiple assign.
out_QuoteNumber = System.Text.RegularExpressions.Regex.Match(EmailBody,β(?<=QuoteNumber : ).+β).Value
that gives me result β123β
out_AccountSapId = System.Text.RegularExpressions.Regex.Match(EmailBody,β(?<=SAP ID of Account : ).+β).Value
that doesnt give me β345β
You get it?
I just want to read values : β123β, β345β, β567β, β897β into different variables in my multiple assing activity.
@jeyekij306 - Is this what you are looking for??
@ppr has already provided the solution for this in his post.
A kind request, next time before completing your testing do not mark the post as solution.
system
(system)
Closed
August 13, 2021, 3:22pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.