Split Title Name and Last Name

Hello Everyone

Good day!

I wanted to split a value from a field into 3 (Title, Name, and Last Name). Please see sample below. The thing is, some times, the name has 2 names or the title changes so I don’t know how to handle it. Thanks

Data

Name
Mr. James Callos
Mr James Callos
Mister James Callos
Miss Joy Aquino
Mrs. Joy Aquino
Ms Angela Joy Aquino

Expected output

`Title Name Last Name
Mr. James Callos
Mr James Callos
Mister James Callos
Miss Joy Aquino
Mrs. Joy Aquino
Ms Angela Joy Aquino

@Callos_James_AU

You can split by space, example :point_down:

Split(“Mister James Callos”," ")(1)
Output : Mister

Hello @mz3bel thanks for this! but I need to split or output the name field into 3 fields which are Title, First Name, and Last Name. and If I use space, won’t there will be a problem if there is second name in it? Thanks

1 Like

@Callos_James_AU

I don’t realy get what you mean by title, name… etc… But you can do this…

Split(“Mister James Callos”," ")(1)
Output : Mister

Split(“Mister James Callos”," ")(2)
Output : James

Split(“Mister James Callos”," ")(3)
Output : Callos

Hello @mz3bel

Sorry, what I meant was because the Name field sometimes has two names (for example: Ms Angela Joy Aquino). So if we use Split(“Mister James Callos”," ")(1)… then the output will be

Ms
Angela
Joy

Not
Ms
Angela Joy
Aquino

1 Like

Hi,

Can you try Matches activity with the following settings?

Pattern: "(^\w+|(?<=\s).+(?=\s)|\w+$)"

Regards,

1 Like

Hello @Yoichi sorry, I don’t know how to use that. :sweat_smile: Could you please share at least a screenshot of matches activity using the pattern you provided? Thanks

1 Like

Hi,

Hope the following image helps you.

We can also access the content directly by result(0) etc.

Regards,

1 Like

Hello @Yoichi

SplitName.xaml (7.4 KB)

It’s working but giving incorrect/last name output only :frowning:

1 Like

Hi,

I just updated it as the following.

SplitName.xaml (7.5 KB)

The pattern should be "(^[\w\.]+|(?<=\s).+(?=\s)|\w+$)" because title might contain period.

Regards,

4 Likes

Hello @Yoichi

It is working now!! Thanks again! You saved my life again! :smiley:

2 Likes

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