How to get the only id

Here is the email body 11
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
12
but i only want the id number , not included the name. Please help me with this. Thanks.

1 Like

@jiejie

Try this:

item.Body.ToString.Split({“Name:”,“Designation:”}, StringSplitOptions.None).split(",".TocharArray)(0)

1 Like

13

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

1 Like

@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

1 Like

@indra Here is my email body

08

Thanks.

@jiejie Can you share in text format

1 Like

@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.

@jiejie Here is a Regular Expression

1 Like

is that assign equal to (?<=Name).*(?=Designation) ??

@indra

@jiejie Have you ever used regular expression before

1 Like

nope @indra

see here. information on using regex using matches activity.

1 Like

@jiejie Here you go Regular-Expression.zip (10.9 KB)

1 Like

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:

1 Like

@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 ! :slight_smile:

Regards,
Hemal

1 Like

data1.ToString.Split({“Name:”,“Designation:”}, StringSplitOptions.None)(1).Split(","c)(0)

data1 is my variable

2 Likes

name = “88098818, Noni A/p Sepit”
id = Split(name.ToString,",")(0).ToString

1 Like