Regex working in regex online tester but fails in uipath studio

Hi, below regex is working correctly in regex online tester but not in uipath studio .I want to split the below string as shown in output .

string = large number (132.45,34) small unit 543.231 data 174.4567 test_number (888.99,00) Reserve_Number (290.881,56) Amount 6666.34 Total Amount (4568.99,56)

Regex :- [[:graph:]]+\d+[[:graph:]]+

The numbers with bracket can be matched with online regex tester but uipath can’t find any match for this .
Please help with this issue .

Use below code in assign activity,
Var(MatchCollection) = System.Text.RegularExpressions.Regex.Matches(YourString,"[[:graph:]]+\d+[[:graph:]]+").

1 Like

Check this workflow,
SampleSequence.xaml (6.2 KB)

Hi @Manish540 I have already tried this solution but had check your xaml also but still not getting match .

PFA below Screen shot

You want just the numbers from that right??

Check with this updated code,
System.Text.RegularExpressions.Regex.Matches(YourString,"[0-9.,]+")

yes right.Actually I want this following desired output from that string .

EXPECTED OUTPUT :-

large number (132.45,34)
small unit 543.231
data 174.4567
test_number (888.99,00)
Reserve_Number (290.881,56)
Amount 6666.34
Total Amount (4568.99,56)

with above regex i am getting following matches on online regex debugger

image

@Manish540 I think the character class such as attached below cant be used in uipath . I have tried [[:upper:]] also but no matched found.

image

1 Like

hey is those large number,small unit and so on all those strings are fixed??

Hi @HimanshuSonawane,

regexHelp.xaml (5.5 KB)

Regex Pattern: “((|)[0-9.,]+()|)”

Thanks!

UiPath is built on .Net Engine and .NET regex engine does not support POSIX character classes. It only supports regular expression character classes. This is the reason you are not getting the output. You have [[:graph:]] which has to be replaced with \w or [A-Za-z]+

Often people gets confused with POSIX class and CHaracter class. [x-z0-9] is an example of a “character class” and [:digit:] is a POSIX character class, used inside a bracket expression like [x-z[:digit:]].

To answe why you are getting result in online testers, there are different online regex testing websites. Some of which are built based on javascript. UiPath uses .NET based regex engine. The website you used to test online may not be built on .NET engine. You can use, .NET Regex Tester - Regex Storm which is a .NET regex tester and provides almost 99% accuracy when the expression is executed in UiPath.

Try the below expression. This with provide values along with the field names.
[A-Za-z_ ]+[0-9.,/(/)]+

Also use the OOTB UiPath activities IsMach and Marches instead of using a assign statement and writing custom VB code.

Let me know if this helps you.

5 Likes

Nope bro .They can be change dynamically .

Thank you so much for the solution @Madhavi . Got the exact result expected .And thanks for .NET Regex Tester - Regex Storm this suggestion also

1 Like

@kadiravan_kalidoss ,@Pradeep_Shiv ,@Manish540 and Madhavi Thanks you so much guys for your time and soln .

1 Like

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