# Regex Help Needed

**URL:** <https://forum.uipath.com/t/regex-help-needed/121094>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [May 30, 2019, 9:46am UTC](https://forum.uipath.com/t/regex-help-needed/121094 "2019-05-30T09:46:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [May 30, 2019, 9:46am UTC](https://forum.uipath.com/t/regex-help-needed/121094/1 "2019-05-30T09:46:01Z")

</div>

Hi Team,

I just need to extract just the storenames just after the string “Add new store” from the below lines. My expected result is ABC,XYZ

Add new store ABC  
Add new store XYZ  
Change store FSFJ to FSFSFSFS  
Change store rtrtrt to svdfdf

I tried with below regex and it gives me entire text  
“(?\<=Add new store)(.\*)”  
ABC,XYZ,Change store FSFJ to FSFSFSFS  
Change store rtrtrt to svdfdf

---

<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 30, 2019, 9:52am UTC](https://forum.uipath.com/t/regex-help-needed/121094/2 "2019-05-30T09:52:17Z")

</div>

> [@Teenu](#):
>
> Add new store ABC  
> Add new store XYZ  
> Change store FSFJ to FSFSFSFS  
> Change store rtrtrt to svdfdf

@Teenu

Try this:

yourStr = “Add new store ABC  
Add new store XYZ  
Change store FSFJ to FSFSFSFS  
Change store rtrtrt to svdfdf”

**requiredString1 = yourStr.substring(yourStr.IndexOf("Add new store ")+"Add new store ".Length).Split(Environment.NewLine.TocharArray)(0)**

**requiredString2 = yourStr.substring(yourStr.IndexOf("Add new store ")+"Add new store ".Length).Split(Environment.NewLine.TocharArray)(1)**

---

<div class="post-metadata">

**Author:** ![KarthikByggari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/karthikbyggari/32/430060_2.png) [@KarthikByggari](https://forum.uipath.com/u/KarthikByggari)\
**Post date:** [May 30, 2019, 9:56am UTC](https://forum.uipath.com/t/regex-help-needed/121094/3 "2019-05-30T09:56:37Z")

</div>

I do not see any issue with the expression that you gave.  
I had tested the regular expression and getting the expected results.

 ![image](https://global.discourse-cdn.com/uipath/original/3X/6/d/6d61a7113e34c759ba1e00a1130ea5360ec7edce.png)

 ![image](https://global.discourse-cdn.com/uipath/original/3X/e/4/e4af309bd1300371445c0a037abb9cf1b6c619f2.png)

---

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [May 30, 2019, 10:07am UTC](https://forum.uipath.com/t/regex-help-needed/121094/4 "2019-05-30T10:07:52Z")

</div>

Yes, it works fine with regex editor. Except that it takes/m/g characters in regex editor

---

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [May 30, 2019, 10:13am UTC](https://forum.uipath.com/t/regex-help-needed/121094/5 "2019-05-30T10:13:43Z")

</div>

Not sure why it doesn’t in code when it works in regex editor

---

<div class="post-metadata">

**Author:** ![KarthikByggari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/karthikbyggari/32/430060_2.png) [@KarthikByggari](https://forum.uipath.com/u/KarthikByggari)\
**Post date:** [May 30, 2019, 10:21am UTC](https://forum.uipath.com/t/regex-help-needed/121094/6 "2019-05-30T10:21:49Z")

</div>

Let me check in code and let you know the details.

---

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [May 30, 2019, 10:25am UTC](https://forum.uipath.com/t/regex-help-needed/121094/7 "2019-05-30T10:25:50Z")

</div>

Thank you so much

---

<div class="post-metadata">

**Author:** ![KarthikByggari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/karthikbyggari/32/430060_2.png) [@KarthikByggari](https://forum.uipath.com/u/KarthikByggari)\
**Post date:** [May 30, 2019, 10:34am UTC](https://forum.uipath.com/t/regex-help-needed/121094/8 "2019-05-30T10:34:40Z")

</div>

Here is with code. The following regex expression worked.

`(?<=\bAdd new store\s)(\w*)`

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

---

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [May 30, 2019, 8:00pm UTC](https://forum.uipath.com/t/regex-help-needed/121094/9 "2019-05-30T20:00:26Z")

</div>

> [@KarthikByggari](#):
>
> `(?<=\bAdd new store\s)(\w*)`

Hi Karthik,

I have used the pattern in the Matches activity as  
“(?\<=\bAdd new store\s)(\w\*)” and input is my entire string:  
“Add new store ABC  
Add new store XYZ  
Change store FSFJ to FSFSFSFS  
Change store rtrtrt to svdfdf”

But I get only one store ie,ABC and not reading next line

---

<div class="post-metadata">

**Author:** ![KarthikByggari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/karthikbyggari/32/430060_2.png) [@KarthikByggari](https://forum.uipath.com/u/KarthikByggari)\
**Post date:** [June 1, 2019, 8:02am UTC](https://forum.uipath.com/t/regex-help-needed/121094/10 "2019-06-01T08:02:20Z")

</div>

Can you try in the following way.

Can you replace all new lines in your string into Space.  
And then use the given regex pattern.

I guess it is failing to get from the new lines. Just a thought.

---

<div class="post-metadata">

**Author:** ![Teenu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/teenu/32/64828_2.png) [@Teenu](https://forum.uipath.com/u/Teenu)\
**Post date:** [June 3, 2019, 7:42am UTC](https://forum.uipath.com/t/regex-help-needed/121094/11 "2019-06-03T07:42:22Z")

</div>

No luck:(
