Split specifc text

Hello, i’m having a hard time with splitting a specific text. I tried working with Find Text Position-, Find Text- , Get Full Text-Activity and with methods like subString, Trim, etc. but i just can’t solve the problem.

I’ve got a text like this:

image

And i want the text to be splitted like this (in three different variables):
Random-Street 2 ← which is my first variable
12345 ← second variable
Random City ← third variable

So basically i just want the text to be splitted after every new line.

Thank you very much in advance for your help!

2 Likes

@Mod091

Use Get Text activity and store output in a variable of type String and say randomText.

Address - randomText.subString(randomText.IndexOf("Address: "+"Address: ".length).split(Environment.NewLine.TocharArray)(0)

Postal Code - randomText.subString(randomText.IndexOf("Postal Code: "+"Postal Code: ".length).split(Environment.NewLine.TocharArray)(0)

City -

randomText.subString(randomText.IndexOf("City: "+"City: ".length).split(Environment.NewLine.TocharArray)(0)

hello @lakshman thanks for your fast reply. I’ve tried that and it doesn’t work. What am i doing wrong? :thinking:

Buddy @Mod091
Try like this buddy and it worked

FirstVariable = Split(outtext.split(Environment.Newline.ToArray(),StringSplitOptions.RemoveEmptyEntries)(0),": ")(1).ToString

SecondVariable = Split(outtext.split(Environment.Newline.ToArray(),StringSplitOptions.RemoveEmptyEntries)(1),": ")(1).ToString

ThirdVariable = Split(outtext.split(Environment.Newline.ToArray(),StringSplitOptions.RemoveEmptyEntries)(2),": ")(1).ToString

Hope this would help you

Cheers

1 Like

Hey @Palaniyappan, it doesn’t work either. :frowning: i don’t know what i’m doing wrong…where do i have to write the “in_tex_variable.split(Environment.Newline.ToArray(),StringSplitOptions.RemoveEmptyEntries)(0).Split(”: “)(1).ToString” - Part?

1 Like

@Mod091

Could you please go to that exclamation mark and show me error what it is showing ?

1 Like

buddy @Mod091 here is your xaml buddy its resolved and i made few changes inthe last comment as well, kindly take that buddy thats what i have used here in xaml alos
i tried and its working buddy @Mod091
textsplit.zip (1.9 KB)

1 Like

@Mod091,

Can you please use Regex operation for this. I have created one work flow for you please check and let me know.

Please use this logic this might work:

System.Text.RegularExpressions.Regex.Match(myStringVal,“((?<=Address.).*)”).Value

System.Text.RegularExpressions.Regex.Match(myStringVal,“((?<=Postal Code.).*)”).Value

System.Text.RegularExpressions.Regex.Match(myStringVal,“((?<=City.).*)”).Value

GetSpecificWorkInSentance.zip (12.2 KB)

Thanks,
Arunachalam.

3 Likes

Use regular expression pattern like below.

(?<=Address: ).*

For others replace Address with Postal Code etc.

1 Like

@lakshman, @Palaniyappan, @Arunachalam and @KannanSuresh thanks a lot guys for your help. It worked perfectly fine for me with the regex operations!

2 Likes

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