# Error on expression

**URL:** <https://forum.uipath.com/t/error-on-expression/316229>\
**Category:** Apps\
**Tags:** question, studio, activities\
**Created:** [May 19, 2021, 11:04am UTC](https://forum.uipath.com/t/error-on-expression/316229 "2021-05-19T11:04:32Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [May 19, 2021, 11:04am UTC](https://forum.uipath.com/t/error-on-expression/316229/1 "2021-05-19T11:04:32Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/4/1/4184dfa40b07adbd9c8d227632111deca8b8ef12.jpeg)  
Please help me it works fine on one xaml when i change the function to another xaml i got this error  
This is very urgent pls help me to rectify this error

---

<div class="post-metadata">

**Author:** ![sarathi125](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sarathi125/32/519448_2.png) [@sarathi125](https://forum.uipath.com/u/sarathi125)\
**Post date:** [May 19, 2021, 11:07am UTC](https://forum.uipath.com/t/error-on-expression/316229/2 "2021-05-19T11:07:40Z")

</div>

@Sudharsan_Ka ,

In the code change this and try,

```auto
Cast(Of System.Text.RegularExpression.Regex.Matches).Select(Function(m) m.Value).ToList()

```

---

<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:** [May 19, 2021, 11:10am UTC](https://forum.uipath.com/t/error-on-expression/316229/3 "2021-05-19T11:10:26Z")

</div>

> [@sarathi125](#):
>
> `Cast(Of System.Text.RegularExpression.Regex.Matches).Select(Function(m) m.Value).ToList()`

Getting this error

 ![image](https://global.discourse-cdn.com/uipath/original/3X/7/f/7fd8d9540a4326b5c6b33789a32e2b2d21612530.png)

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 11:10am UTC](https://forum.uipath.com/t/error-on-expression/316229/4 "2021-05-19T11:10:38Z")

</div>

@Sudharsan_Ka - it is cast of Match …not matches …

---

<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:** [May 19, 2021, 11:11am UTC](https://forum.uipath.com/t/error-on-expression/316229/5 "2021-05-19T11:11:57Z")

</div>

Same error is shown

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 11:15am UTC](https://forum.uipath.com/t/error-on-expression/316229/6 "2021-05-19T11:15:10Z")

</div>

@Sudharsan_Ka - This is my working code, which is almost similar to what you are trying…

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

Please show us your complete asssign statement with the variable type.

---

<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:** [May 19, 2021, 11:16am UTC](https://forum.uipath.com/t/error-on-expression/316229/7 "2021-05-19T11:16:20Z")

</div>

My whole expression is like  
**System.Text.RegularExpressions.Regex.Matches(input\_data,“.\*(?=Acord)”).Cast(Of Match).Select(Function(m) m.Value).ToList().Where(Function(r) r.ToString\<\>“”).Count.ToString**  
I need to change anything here

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 11:20am UTC](https://forum.uipath.com/t/error-on-expression/316229/8 "2021-05-19T11:20:44Z")

</div>

> [@Sudharsan\_Ka](#):
>
> System.Text.RegularExpressions.Regex.Matches(input\_data,“.\*(?=Acord)”).Cast(Of Match).Select(Function(m) m.Value).ToList().Where(Function(r) r.ToString\<\>“”).Count.ToString

@Sudharsan_Ka - I see no error when I added this…Since I dont have the input data, mocked input data as string for testing purpose…

![image](https://global.discourse-cdn.com/uipath/original/3X/7/3/739846facd5417a9393a5068054a95628508fbef.png)

StrCount is String Variable…

Note: Import the below if its still showing an error

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

---

<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:** [May 19, 2021, 11:31am UTC](https://forum.uipath.com/t/error-on-expression/316229/9 "2021-05-19T11:31:22Z")

</div>

How to import that bro

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 11:33am UTC](https://forum.uipath.com/t/error-on-expression/316229/10 "2021-05-19T11:33:31Z")

</div>

@Sudharsan_Ka - just type in the search bar on the import tab as system.text.regular.expressions

---

<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:** [May 19, 2021, 11:52am UTC](https://forum.uipath.com/t/error-on-expression/316229/11 "2021-05-19T11:52:52Z")

</div>

> [@Sudharsan\_Ka](#):
>
> System.Text.RegularExpressions.Regex.Matches(input\_data,“.\*(?=Acord)”).Cast(Of Match).Select(Function(m) m.Value).ToList().Where(Function(r) r.ToString\<\>“”).Count.ToString

when i click on the System.Text.Regulare Expressions  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/7/4/74f0541ab14a402d2c969385292821af9c2dd3fe.png)

---

<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:** [May 19, 2021, 11:56am UTC](https://forum.uipath.com/t/error-on-expression/316229/12 "2021-05-19T11:56:41Z")

</div>

still same error

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

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 12:01pm UTC](https://forum.uipath.com/t/error-on-expression/316229/13 "2021-05-19T12:01:15Z")

</div>

> [@Sudharsan\_Ka](#):
>
> when i click on the System.Text.Regulare Expressions

Where you clicked??? I am not sure…

![image](https://global.discourse-cdn.com/uipath/original/3X/9/2/92240a085de0e48094920ea402518789ab2153fd.png)

What is the variable type of CountGDPR?

Please share the text which you are getting for pbdw1, i will share the code for you…

---

<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:** [May 19, 2021, 12:13pm UTC](https://forum.uipath.com/t/error-on-expression/316229/14 "2021-05-19T12:13:22Z")

</div>

Comunicari in vederea derularii contractului de furnizare e.e. Acord Dezacord  
Comunicari Marketing, campanii si comercializare produse Acord Dezacord  
Participarea la sondaje de piata Acord Dezacord

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 12:19pm UTC](https://forum.uipath.com/t/error-on-expression/316229/15 "2021-05-19T12:19:50Z")

</div>

@Sudharsan_Ka - ok thanks…you want the count of matches??

---

<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:** [May 19, 2021, 12:26pm UTC](https://forum.uipath.com/t/error-on-expression/316229/16 "2021-05-19T12:26:12Z")

</div>

I have screen scrapped from the app  
I just need the count of rows

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 12:41pm UTC](https://forum.uipath.com/t/error-on-expression/316229/17 "2021-05-19T12:41:56Z")

</div>

@Sudharsan_Ka - Here StrTest is your text input, in your case pbdw1…

```
   Strtest.split(Environment.NewLine.ToCharArray).count.ToString

```

Please check and let us know…

---

<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:** [May 19, 2021, 12:49pm UTC](https://forum.uipath.com/t/error-on-expression/316229/18 "2021-05-19T12:49:51Z")

</div>

> [@prasath17](#):
>
> ` Strtest.split(Environment.NewLine.ToCharArray).count.ToString`

It is showing the result as 5 bro  
In my case i am only having 3 rows

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 1:00pm UTC](https://forum.uipath.com/t/error-on-expression/316229/19 "2021-05-19T13:00:20Z")

</div>

@Sudharsan_Ka - You gave a 3 line text and When i am running i am getting count as 3…you getting 5…something is not right here…

Let me try the Regex route…

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [May 19, 2021, 1:05pm UTC](https://forum.uipath.com/t/error-on-expression/316229/20 "2021-05-19T13:05:23Z")

</div>

@Sudharsan_Ka - Please try this…

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

```
system.text.RegularExpressions.regex.Matches(Strtest,".+(?=Acord)").Count.ToString

```

.\* - will give 5 matches, That’s why I adjusted it to .+ which gives only 3 matches…

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

[Next page](https://forum.uipath.com/t/error-on-expression/316229.md?page=2)
