# Split specifc text

**URL:** <https://forum.uipath.com/t/split-specifc-text/116307>\
**Category:** Help\
**Tags:** studio, activities\
**Created:** [May 13, 2019, 4:24pm UTC](https://forum.uipath.com/t/split-specifc-text/116307 "2019-05-13T16:24:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mod091](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mod091](https://forum.uipath.com/u/Mod091)\
**Post date:** [May 13, 2019, 4:24pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/1 "2019-05-13T16:24:21Z")

</div>

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](https://global.discourse-cdn.com/uipath/original/3X/2/a/2a7baf5372ddc75c40cbd8497f0a50bb85f114ca.png)

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!

---

<div class="post-metadata">

**Author:** ![lakshman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lakshman/32/523490_2.png) [@lakshman](https://forum.uipath.com/u/lakshman)\
**Post date:** [May 13, 2019, 4:41pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/2 "2019-05-13T16:41:59Z")

</div>

@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)**

---

<div class="post-metadata">

**Author:** ![Mod091](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mod091](https://forum.uipath.com/u/Mod091)\
**Post date:** [May 13, 2019, 4:58pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/3 "2019-05-13T16:58:25Z")

</div>

> [@lakshman](#):
>
> 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)**

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

 ![image](https://global.discourse-cdn.com/uipath/original/3X/c/a/ca7f34f2d62c0d16be0d78b2a6e8d659cf69a4bf.png)

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [May 13, 2019, 5:06pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/4 "2019-05-13T17:06:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mod091](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mod091](https://forum.uipath.com/u/Mod091)\
**Post date:** [May 13, 2019, 5:14pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/5 "2019-05-13T17:14:22Z")

</div>

Hey @Palaniyappan, it doesn’t work either. ☹ 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?

---

<div class="post-metadata">

**Author:** ![lakshman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lakshman/32/523490_2.png) [@lakshman](https://forum.uipath.com/u/lakshman)\
**Post date:** [May 13, 2019, 5:16pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/6 "2019-05-13T17:16:19Z")

</div>

@Mod091

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

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [May 13, 2019, 5:17pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/7 "2019-05-13T17:17:01Z")

</div>

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](https://global.discourse-cdn.com/uipath/original/3X/a/2/a20c8196274a596c946c97720380560da04bd70f.zip) (1.9 KB)

---

<div class="post-metadata">

**Author:** ![Arunachalam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arunachalam/32/58238_2.png) [@Arunachalam](https://forum.uipath.com/u/Arunachalam)\
**Post date:** [May 13, 2019, 5:18pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/8 "2019-05-13T17:18:53Z")

</div>

@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](https://global.discourse-cdn.com/uipath/original/3X/9/8/987c0f7a30f8181eed0870dbde5638124958c3b7.zip) (12.2 KB)

Thanks,  
Arunachalam.

---

<div class="post-metadata">

**Author:** ![KannanSuresh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kannansuresh/32/116003_2.png) [@KannanSuresh](https://forum.uipath.com/u/KannanSuresh)\
**Post date:** [May 13, 2019, 5:20pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/9 "2019-05-13T17:20:22Z")

</div>

Use regular expression pattern like below.

`(?<=Address: ).*`

For others replace `Address` with `Postal Code` etc.

---

<div class="post-metadata">

**Author:** ![Mod091](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mod091](https://forum.uipath.com/u/Mod091)\
**Post date:** [May 13, 2019, 5:38pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/10 "2019-05-13T17:38:16Z")

</div>

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

> [@Arunachalam](#):
>
> **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**

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [May 16, 2019, 5:38pm UTC](https://forum.uipath.com/t/split-specifc-text/116307/11 "2019-05-16T17:38:22Z")

</div>

Closed on May 16, 2019, 5:38pm UTC

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