Extracting a specific value


I am looking to extract a specific value from the below
John Harold Smith WR10472285

I need to capture the first name (John), surname (Smith) and wrnumber.
However there are and will be times where there wont be a middle name to capture.

My current code only works when there is no middle name, therefore i can’t use that code.

can anyone help me with this?

@nick.v So you only need the last Value, right ?
you can Try this Split method :

@supermanPunch sorry my mistake the actual cell i am taking the data from will look like this

John Harold Smith WR10472285 BGC From: 11-11-22 14122415

How would i be able to get the first name, surname and the wrnumber from this cell?

@nick.v Will the BGC be present always?

@supermanPunch i can’t say for sure, most of the time it will be there but there will be occasions where its not present

@nick.v Will the WR Number have the WR at the beginning always? Also Can you tell me what values will be appearing always?

@supermanPunch yes the wr number will always have the WR infront of it.
Values that will present will be Firstname, Surname, WR number and the data after but i dont need that data to be stored.

@nick.v Ok, So The Data will always be present int that order right ? First names and then the WR Number ?

@supermanPunch yeah 1. first name 2. middle name (if they have one) 3. surname 4. wrnumber

@nick.v Can you Check this workflow :
ExtractValuesFromString.xaml (8.8 KB)

That’s brilliant thank you, am a little confused how would i test this? @supermanPunch

@nick.v I have a String variable called test, I have assigned a default value to it. You can test for all the Strings by changing the default value.

aahh that works thank you, so if i wanted to add this code to my workflow as am taking the data from a spreadsheet how can i do that? do i save the variable thats taking the data from the cell as test? @supermanPunch

@supermanPunch also the data that is taken from the google spreadsheet is a object, when i put as a string uipath gives me errors

@nick.v You just need to replace the test variable with the value which you get from SpreadSheet

@nick.v What error?

it cant read the google sheets spreadsheet if the variable type is a string but when i put it to object the google sheets has no error but the workflow you provided does have errors, when its string variable then i have any error on the google sheets read cell activity but not on your workflow @supermanPunch am slightly confused

@nick.v Which Activity are you using to get the Value from SpreadSheet? If Object Type Works, keep it as Object, but then when you use it in my Workflow, use it as objectVariable.ToString

i am using read cell. thanks ill give that ago an let you know how i get on

Where do i put the test.ToString? does it need to be assigned?

@nick.v Can I get a Screenshot of the Workflow or the Workflow Itself :sweat_smile: