# Regular expression error

**URL:** <https://forum.uipath.com/t/regular-expression-error/554553>\
**Category:** Studio\
**Tags:** activities-panel, question, studio\
**Created:** [June 16, 2023, 4:28am UTC](https://forum.uipath.com/t/regular-expression-error/554553 "2023-06-16T04:28:56Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 16, 2023, 4:28am UTC](https://forum.uipath.com/t/regular-expression-error/554553/1 "2023-06-16T04:28:56Z")

</div>

hi Team  
Error ERROR Validation Error BC30002: Type ‘Match’ is not defined. Type ‘Match’ is missing. You probably need to add an Activity Package to your workflow.

Error ERROR Validation Error BC30451: ‘RegexOptions’ is not declared. It may be inaccessible due to its protection level. Variable ‘RegexOptions’ is missing. Please use Data Manager to recreate it.

Can anyone help me with below 2 errors pls

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [June 16, 2023, 4:31am UTC](https://forum.uipath.com/t/regular-expression-error/554553/2 "2023-06-16T04:31:13Z")

</div>

Hi,

Can you try to add full namespace (System.Text.RegularExpressions.) as the following, for example?

```
System.Text.RegularExpressions.Regex.Match(yourString,"\d+",System.Text.RegularExpressions.RegexOptions.IgnoreCase)

```

Regards,

---

<div class="post-metadata">

**Author:** ![Gokul001](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokul001/32/462734_2.png) [@Gokul001](https://forum.uipath.com/u/Gokul001)\
**Post date:** [June 16, 2023, 4:31am UTC](https://forum.uipath.com/t/regular-expression-error/554553/3 "2023-06-16T04:31:36Z")

</div>

Hi @Gayathri_Mk

Ensure that you have imported the necessary namespaces: Verify that you have imported the `System.Text.RegularExpressions` namespace in your UiPath project.

```auto
System.Text.RegularExpressions.match

```

Regards  
Gokul

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 16, 2023, 4:32am UTC](https://forum.uipath.com/t/regular-expression-error/554553/4 "2023-06-16T04:32:37Z")

</div>

System.Text.RegularExpressions.Regex.Matches(output,“^\s\*\d{6}\s+[\s\S]+?(?=Plan Total)”,RegexOptions.Multiline).Cast(Of Match).Select(Function(m) m.Value.ToString).ToArray()

this is my regular expression

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [June 16, 2023, 4:34am UTC](https://forum.uipath.com/t/regular-expression-error/554553/5 "2023-06-16T04:34:26Z")

</div>

Hi,

How about the following?

```
System.Text.RegularExpressions.Regex.Matches(output,"^\s*\d{6}\s+[\s\S]+?(?=Plan Total)",System.Text.RegularExpressions.RegexOptions.Multiline).Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value).ToArray()

```

Regards,

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 16, 2023, 4:39am UTC](https://forum.uipath.com/t/regular-expression-error/554553/6 "2023-06-16T04:39:41Z")

</div>

It worked now error gone.  
Thanks @Yoichi for your help

---

<div class="post-metadata">

**Author:** ![Nicolai\_Kruger](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nicolai_kruger/32/47380_2.png) [@Nicolai\_Kruger](https://forum.uipath.com/u/Nicolai_Kruger)\
**Post date:** [June 16, 2023, 4:47am UTC](https://forum.uipath.com/t/regular-expression-error/554553/7 "2023-06-16T04:47:33Z")

</div>

Just a bit curious, why don’t you use the default activity for RegEx Matching?  
[https://docs.uipath.com/activities/other/latest/user-guide/matches](https://docs.uipath.com/activities/other/latest/user-guide/matches)

---

<div class="post-metadata">

**Author:** ![Steven\_McKeering](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/steven_mckeering/32/153939_2.png) [@Steven\_McKeering](https://forum.uipath.com/u/Steven_McKeering)\
**Post date:** [June 16, 2023, 10:54am UTC](https://forum.uipath.com/t/regular-expression-error/554553/9 "2023-06-16T10:54:42Z")

</div>

Hey

What’s the name of the variable they are saved to?

Cheers

Steve

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [June 16, 2023, 1:57pm UTC](https://forum.uipath.com/t/regular-expression-error/554553/10 "2023-06-16T13:57:39Z")

</div>

Hi,

Can you clarify your requirement? If possible, can you share input and expected sample and current pattern / expression?

Regards,

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [June 17, 2023, 4:57am UTC](https://forum.uipath.com/t/regular-expression-error/554553/12 "2023-06-17T04:57:39Z")

</div>

@Gayathri_Mk

For amount we can use `output(0).Split({"$"},StringSplitOptions.None)(1)`

For getting date the type of loan if you have a  
List of available values it is better to match it as it is beside a name only like say the possible values are `{"Distribution","Initiate Loan"}` stored in an array arr1 then `use arr1.First(function(x) output(0).Contains(x))`

Now as you know the matched type value replace that from the output(0) and then extract only the name before the date to get the name value using expression `.*(?=\d{2}/\d{2}/\d{4})` …In the resultant value initiate loan can be replaced as it is already identified in previous step and can get the name

 ![IMG_5945](https://global.discourse-cdn.com/uipath/original/4X/7/c/1/7c1a159756a42a07a9d27396d4a38cef95b1e255.jpeg)

Hope this helps

Cheers

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 19, 2023, 4:05am UTC](https://forum.uipath.com/t/regular-expression-error/554553/13 "2023-06-19T04:05:51Z")

</div>

I am able to extract amount not the other values can you pls help

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [June 19, 2023, 4:09am UTC](https://forum.uipath.com/t/regular-expression-error/554553/14 "2023-06-19T04:09:21Z")

</div>

@Gayathri_Mk

> [@Anil\_G](#):
>
> get the name value using expression `.*(?=\d{2}/\d{2}/\d{4})` …In the resultant value initiate loan can be replaced as it is already identified in previous step and can get the name

As stated above you can get name plus the type using the above regular expression

And if you know the different types that are possible then we need to use as below to check if that is present

> [@Anil\_G](#):
>
> `{"Distribution","Initiate Loan"}` stored in an array arr1 then `use arr1.First(function(x) output(0).Contains(x))`

Then use replace activity to replace and only get the name

Cheers

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 19, 2023, 4:28am UTC](https://forum.uipath.com/t/regular-expression-error/554553/15 "2023-06-19T04:28:10Z")

</div>

HATCH, CHRIS N DISTRIBUTION  
I got this values the output is rg\_name(0).Value

I need to split this using tab as delimiter and extract HATCH, CHRIS N and DISTRIBUTION  
seperately how to do this .after N we have tab.

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [June 19, 2023, 4:32am UTC](https://forum.uipath.com/t/regular-expression-error/554553/16 "2023-06-19T04:32:11Z")

</div>

@Gayathri_Mk

if we have a tab separator then try this

`Regex.Split(str,"\t\n?")`

Or try with below

`Regex.Split(str,"\s{2,}")`

Cheers

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [June 19, 2023, 5:44am UTC](https://forum.uipath.com/t/regular-expression-error/554553/17 "2023-06-19T05:44:31Z")

</div>

it worked thank you for your help @Anil_G

---

<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:** [June 22, 2023, 5:44am UTC](https://forum.uipath.com/t/regular-expression-error/554553/18 "2023-06-22T05:44:55Z")

</div>

Closed on June 22, 2023, 5:44am UTC

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