Regular expression error

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

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,

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.

System.Text.RegularExpressions.match

Regards
Gokul

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

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,

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

1 Like

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

Hey

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

Cheers

Steve

Hi,

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

Regards,

@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

Hope this helps

Cheers

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

@Gayathri_Mk

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

Then use replace activity to replace and only get the name

Cheers

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.

@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

it worked thank you for your help @Anil_G

1 Like

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