Splitting a scraped value

Good day,

i am having trouble splitting this string below.

REPLY l To content postSENTIMENT l Positive

i have tried different ways to split it but havent got it right.
i need to split it by REPLY | To content post and SENTIMENT | Positive
this is a small part from the screen scraped value.

the aim is to finally get the value for REPLY and SENTIMENT and store in seperate variables.

Thank you.

Hi @zahpat

Welcome back to UiPath community
may i know which value you want from this string, sorry i didn’t get that properly
REPLY l To content postSENTIMENT l Positive
and as you have mentioned this as well

kindly give us the full extracted data structure so that it would easy to get the split expression
This can be easily resolved buddy

Cheers @zahpat

1 Like

hi @zahpat try this …
in assign activity create variable of type array of strings and then
.Split(“l”).ToArray
then (0) will return REPLY
and (2) will return Positive

Thanks @Palaniyappan :slight_smile:

sorry i meant there could be a lot of values, below is one example but there could be other “Tags” added

CAMPAIGN l Facebook adsDIVISION l SalesGENERAL l Client informationREPLY l To content postSENTIMENT l Positive

hope this helps.

Thanks @kalyanDev i will give this a try.

On top of what was said above by @kalyanDev , to return the Reply value of ‘To content post’
Assign strSentiment = FirstArray(2).ToString.Trim

You would then need to split the text again for index item (1) which would be
’ To content postSENTIMENT ’

To split this string you could then use the following and then
Assign strReply = FirstArray(1).ToString.Substring(0, Instr(FirstArray(1).ToString,“SENTIMENT”)-1)

You may have to play around with the index within the arrays.

im not winning with this one, CAMPAIGN l Facebook adsDIVISION l SalesGENERAL l Client informationREPLY l To content post
also the splitting of the bolded part,

Well,

this might work try and let me know.

For each item in the array that is split using the pipe symbol -

Run a regex expression -

YourCombinedWords = Regex.Matches("YourVariable", "([A-Z][a-z]+)").Cast(Of Match)().[Select](Function(m) m.Value)

The output will be collection - so join them using the following

YourWordWithSpaces = string.Join(" ", YourCombinedWords );

Regards :slight_smile:

Thank you guys for all your help.

@zahpat, did it work as expected?

not exactly, but i had to change it around a bit. thanks