# Getting a specified text from a string

**URL:** <https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732>\
**Category:** Studio\
**Tags:** workflow-diff, question, studio, system, activities\
**Created:** [January 10, 2022, 5:10am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732 "2022-01-10T05:10:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Usha\_Sree](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/usha_sree/32/267017_2.png) [@Usha\_Sree](https://forum.uipath.com/u/Usha_Sree)\
**Post date:** [January 10, 2022, 5:10am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/1 "2022-01-10T05:10:36Z")

</div>

I have a string like this..

string=123-456789-123 IN Current account

how to extract 123-456789-123 from the string..Can anyone help me ??

---

<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:** [January 10, 2022, 5:17am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/2 "2022-01-10T05:17:11Z")

</div>

@Usha_Sree

Use below regular expression to fetch the required value.

```
    \d{3}-\d{6}-\d{3}

```

---

<div class="post-metadata">

**Author:** ![Sudharsan\_Ka](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudharsan_ka/32/459826_2.png) [@Sudharsan\_Ka](https://forum.uipath.com/u/Sudharsan_Ka)\
**Post date:** [January 10, 2022, 5:18am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/3 "2022-01-10T05:18:35Z")

</div>

Hi @Usha_Sree

You can use Regex or split method to get the value

Split (StringVar," ")(0)

For Regex try this  
\S+(?=\s[A-Z]+)

> **[regex101: build, test, and debug regex](https://regex101.com/r/S06N2G/1)**
>
> Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.

Regards  
Sudharsan

---

<div class="post-metadata">

**Author:** ![Usha\_Sree](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/usha_sree/32/267017_2.png) [@Usha\_Sree](https://forum.uipath.com/u/Usha_Sree)\
**Post date:** [January 10, 2022, 5:30am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/4 "2022-01-10T05:30:02Z")

</div>

Thank you  
its worked.  
Can you explain what does it exactly mean…Split(VAR," ")(0) …??

---

<div class="post-metadata">

**Author:** ![Sudharsan\_Ka](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudharsan_ka/32/459826_2.png) [@Sudharsan\_Ka](https://forum.uipath.com/u/Sudharsan_Ka)\
**Post date:** [January 10, 2022, 5:36am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/5 "2022-01-10T05:36:30Z")

</div>

Sure @Usha_Sree

It will split all the words which has space between and store that in an array and you can call the array index which you need in your the req text is before the space so Split(," ")(0)

Regards  
Sudharsan

---

<div class="post-metadata">

**Author:** ![Usha\_Sree](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/usha_sree/32/267017_2.png) [@Usha\_Sree](https://forum.uipath.com/u/Usha_Sree)\
**Post date:** [January 10, 2022, 5:37am UTC](https://forum.uipath.com/t/getting-a-specified-text-from-a-string/389732/6 "2022-01-10T05:37:43Z")

</div>

yeah, got it.  
Thank you
