Need help in splitting the string

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.

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,

Use regex builder Activities available in uipath.

1 Like

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 :grinning:

Regards,
Achal Sharma

2 Likes

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

@kirti.iyer, thank you. This works

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