Here is the email body
How if i only want to get id —>>> 88098818.
I use assign item.Body.ToString.Split({“Name:”,“Designation:”}, StringSplitOptions.None),
it give me output like this
but i only want the id number , not included the name. Please help me with this. Thanks.
Try this:
item.Body.ToString.Split({“Name:”,“Designation:”}, StringSplitOptions.None).split(“,”.TocharArray)(0)
Thanks for fast reply, but it show me this.
@jiejie You can use regular expression between Name and Designation so you can get expected result
@indra may i knw how to use regular expression?
@jiejie Can you share the email body data so I can help you with regular expression
@indra Here is my email body
Thanks.
@jiejie Can you share in text format
@indra Can.
Dear Team,
There is a request submitted and approved for your next action as below:
Name:
88098818, Noni A/p Sepit
Designation:
Waiter/waitress
Company and CostCenter:
RWB, 0000000257, MAXIMSGNOOBLEBAR-SRV
Service Name:
3LC System
Attachment:
No Attachement
Thanks.
is that assign equal to (?<=Name).*(?=Designation) ??
@jiejie Have you ever used regular expression before
nope @indra
see here. information on using regex using matches activity.
@jiejie Here you go Regular-Expression.zip (10.9 KB)
Hi, According to me after getting the text like that including name you can use stringName.split(‘,’)(0) to get the id number.
cheers:smiley:
@indra what i want to get is only the id, not included name
Hi @jiejie,
It would work. Do it step by step →
' Split string on comma characters.
' ... Remove empty elements from result.
use assign activity → where create a variable Elements (it will be array of string)
now use assign activity -
elements() =
item.ToString.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries)
' Display elements.
now use for each loop → change the type from object to string
For Each element As String In elements
use message box activity to get your ID -> element
Next
End Sub
Hope it would work.
Cheers !
Regards,
Hemal
data1.ToString.Split({“Name:”,“Designation:”}, StringSplitOptions.None)(1).Split(","c)(0)
data1 is my variable
name = “88098818, Noni A/p Sepit”
id = Split(name.ToString,“,”)(0).ToString