ashok.p
(Ashok)
September 23, 2019, 4:41am
1
Hi,
I am trying to extract some part of the data in email body. I am struck in splitting the body to get the required strings. Below is the email format and I need to get number beside the PO (1234567890) and Recharge Value amount as variables (123.45)
can someone help me
Dear BOT,
Please run invoice creation form for PO 1234567890
Recharge Value: MYR 123.45
Thank you.
ddrdushy1
(Dushyanth)
September 23, 2019, 4:47am
2
Hi @ashok.p ,
You can use regex for extract these values.
Regex for extract PO Number: PO. *
Regex for extract Amount: Recharge Value:. *
use this link to test regex expressions,
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Use regex builder Activities available in uipath.
1 Like
nimin
(nimzz)
September 23, 2019, 4:48am
3
Hi @ashok.p ,
You can use the regex (?<=PO\s).*
to get the number and use (?<=Value: MYR\s).*
to get the recharge value.
Regards,
Nimin
1 Like
hi @ashok.p
Welcome to UiPath Community.
Using split function to split the variable according to you.
Variable.Split({“condition for split”},StringSplitOptions.None)
in your case the split condition is space ie., " " .
Hope this will work out.
Cheers
Regards,
Achal Sharma
2 Likes
kirti.iyer
(Kirti Iyer)
September 23, 2019, 4:50am
5
Hi,
Assign(string) str_PO= System.Text.RegularExpressions.Regex.Match(email.body.ToString,“(?i)(?<=po\s)\d.*”).Value
Assign(string) str_MYR=System.Text.RegularExpressions.Regex.Match(email.body.ToString,“(?i)(?<=myr\s)\d.*”).Value
1 Like
ashok.p
(Ashok)
September 23, 2019, 5:00am
6
@kirti.iyer , thank you. This works
system
(system)
Closed
September 26, 2019, 5:00am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.